Skip to content

Commit

Permalink
Make spawn to type input option correctly based on concrete logics (
Browse files Browse the repository at this point in the history
#4644)

Co-authored-by: Sam Armstrong <[email protected]>
  • Loading branch information
Andarist and DrSammyD authored Jan 1, 2024
1 parent cd33990 commit c586214
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions packages/core/src/spawn.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import { createErrorActorEvent } from './eventUtils.ts';
import { ProcessingStatus, createActor } from './createActor.ts';
import {
ActorRefFrom,
AnyActorScope,
AnyActorLogic,
AnyActorRef,
AnyActorScope,
AnyEventObject,
AnyMachineSnapshot,
ConditionalRequired,
InputFrom,
IsLiteralString,
IsNotNever,
ProvidedActor,
Snapshot,
TODO,
RequiredActorOptions,
IsNotNever,
ConditionalRequired
TODO
} from './types.ts';
import { resolveReferencedActor } from './utils.ts';

Expand Down Expand Up @@ -52,13 +50,12 @@ export type Spawner<TActor extends ProvidedActor> = IsLiteralString<
logic: TSrc,
...[options = {} as any]: SpawnOptions<TActor, TSrc>
) => ActorRefFrom<GetConcreteLogic<TActor, TSrc>>
: // TODO: do not accept machines without all implementations
<TLogic extends AnyActorLogic | string>(
: <TLogic extends AnyActorLogic | string>(
src: TLogic,
options?: {
id?: string;
systemId?: string;
input?: unknown;
input?: TLogic extends string ? unknown : InputFrom<TLogic>;
syncSnapshot?: boolean;
}
) => TLogic extends string ? AnyActorRef : ActorRefFrom<TLogic>;
Expand Down

0 comments on commit c586214

Please sign in to comment.