@@ -1851,7 +1851,7 @@ export interface ChildMachine<Id extends string, M extends Machine.Any> {
18511851 readonly machine : M
18521852
18531853 /** @internal */
1854- readonly [ ChildMachineLogicTypeId ] : ( input : unknown ) => Logic < any , any , any , any , any , any >
1854+ readonly [ ChildMachineLogicTypeId ] : ( input ? : unknown ) => Logic < any , any , any , any , any , any >
18551855}
18561856
18571857/**
@@ -4480,12 +4480,22 @@ export declare namespace Machine {
44804480 readonly onSnapshot ?: never
44814481 }
44824482 & InvokeDoneRequirement <
4483- Effect . Success < Fx > ,
4484- InvokeTransition < States , Events , Emits , InvokeDoneContext < States , Events , Emits , StateId , Effect . Success < Fx > > >
4483+ Effect . Success < NoInfer < Fx > > ,
4484+ InvokeTransition <
4485+ States ,
4486+ Events ,
4487+ Emits ,
4488+ InvokeDoneContext < States , Events , Emits , StateId , Effect . Success < NoInfer < Fx > > >
4489+ >
44854490 >
44864491 & InvokeFailureRequirement <
4487- Effect . Error < Fx > ,
4488- InvokeTransition < States , Events , Emits , InvokeFailureContext < States , Events , Emits , StateId , Effect . Error < Fx > > >
4492+ Effect . Error < NoInfer < Fx > > ,
4493+ InvokeTransition <
4494+ States ,
4495+ Events ,
4496+ Emits ,
4497+ InvokeFailureContext < States , Events , Emits , StateId , Effect . Error < NoInfer < Fx > > >
4498+ >
44894499 >
44904500
44914501 export type TimerInvokeArgs <
@@ -6253,6 +6263,67 @@ export const decodeSnapshot: <
62536263 Machine . SnapshotDecodingServices < States >
62546264> = internal . decodeSnapshot
62556265
6266+ type DynamicEffectInvokeSource <
6267+ States extends Machine . StateSchemas ,
6268+ Events extends ReadonlyArray < Machine . TaggedSchema > ,
6269+ Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6270+ StateId extends Machine . StateIdentifier < States > ,
6271+ Source extends (
6272+ context : Machine . InvokeContext < States , Events , Emits , StateId >
6273+ ) => Effect . Effect < unknown , unknown , unknown >
6274+ > = {
6275+ readonly id : InvokeLifecycleId
6276+ readonly effect : Source
6277+ readonly after ?: never
6278+ readonly logic ?: never
6279+ readonly child ?: never
6280+ readonly address ?: never
6281+ readonly onSnapshot ?: never
6282+ }
6283+
6284+ type DynamicEffectDoneHandler <
6285+ States extends Machine . StateSchemas ,
6286+ Events extends ReadonlyArray < Machine . TaggedSchema > ,
6287+ Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6288+ StateId extends Machine . StateIdentifier < States > ,
6289+ Source extends ( ...args : ReadonlyArray < never > ) => Effect . Effect < unknown , unknown , unknown >
6290+ > = Machine . InvokeTransition <
6291+ States ,
6292+ Events ,
6293+ Emits ,
6294+ Machine . InvokeDoneContext < States , Events , Emits , StateId , Effect . Success < ReturnType < NoInfer < Source > > > >
6295+ >
6296+
6297+ type DynamicEffectFailureHandler <
6298+ States extends Machine . StateSchemas ,
6299+ Events extends ReadonlyArray < Machine . TaggedSchema > ,
6300+ Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6301+ StateId extends Machine . StateIdentifier < States > ,
6302+ Source extends ( ...args : ReadonlyArray < never > ) => Effect . Effect < unknown , unknown , unknown >
6303+ > = Machine . InvokeTransition <
6304+ States ,
6305+ Events ,
6306+ Emits ,
6307+ Machine . InvokeFailureContext < States , Events , Emits , StateId , Effect . Error < ReturnType < NoInfer < Source > > > >
6308+ >
6309+
6310+ type DynamicEffectInvokeResult <
6311+ States extends Machine . StateSchemas ,
6312+ Events extends ReadonlyArray < Machine . TaggedSchema > ,
6313+ Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6314+ StateId extends Machine . StateIdentifier < States > ,
6315+ Source extends ( ...args : ReadonlyArray < never > ) => Effect . Effect < unknown , unknown , unknown >
6316+ > =
6317+ & Machine . InvokeConfig < States , Events , Emits , StateId >
6318+ & Machine . InvokeTyped <
6319+ Effect . Success < ReturnType < Source > > ,
6320+ Effect . Error < ReturnType < Source > > ,
6321+ Effect . Services < ReturnType < Source > > ,
6322+ never
6323+ >
6324+
6325+ type InvokeChannelIsNever < Value > = IsAny < Value > extends true ? false : [ Value ] extends [ never ] ? true : false
6326+
62566327/**
62576328 * Preserves inference for a state-owned invocation configuration.
62586329 *
@@ -6263,11 +6334,9 @@ export const decodeSnapshot: <
62636334 *
62646335 * This constructor is an identity at runtime, but preserves lifecycle callback
62656336 * inference through published declarations. Effects and durations may be
6266- * supplied directly or derived from the owning state's entry context. A direct
6267- * object in the state handler gives function-valued sources and child inputs
6268- * owner-context inference when lifecycle handlers do not consume typed context.
6269- * Use this constructor and annotate a dynamic source's return type when sibling
6270- * handlers need typed output or error values. Logic invocations require both a
6337+ * supplied directly or derived from the owning state's entry context. Dynamic
6338+ * Effect sources infer the owner context, output, error, and service channels
6339+ * together without a return annotation. Logic invocations require both a
62716340 * lifecycle `id` and a typed communication `address`. Child descriptors already
62726341 * own their identity, so `id` and `address` must not be repeated.
62736342 *
@@ -6292,28 +6361,80 @@ export const invoke: {
62926361 const Events extends ReadonlyArray < Machine . TaggedSchema > ,
62936362 const Emits extends ReadonlyArray < Machine . TaggedSchema > ,
62946363 StateId extends Machine . StateIdentifier < States > ,
6295- Output ,
6296- Error ,
6297- Requirements
6364+ const Source extends (
6365+ context : Machine . InvokeContext < States , Events , Emits , StateId >
6366+ ) => Effect . Effect < unknown , unknown , unknown >
62986367 > (
6299- config : Machine . EffectInvokeArgs <
6300- States ,
6301- Events ,
6302- Emits ,
6303- StateId ,
6304- Effect . Effect < Output , Error , Requirements > ,
6305- (
6306- context : Machine . InvokeContext < States , Events , Emits , StateId >
6307- ) => Effect . Effect < Output , Error , Requirements >
6308- >
6309- ) :
6310- & Machine . InvokeConfig < States , Events , Emits , StateId >
6311- & Machine . InvokeTyped <
6312- Output ,
6313- Error ,
6314- Requirements ,
6315- never
6316- >
6368+ config :
6369+ & DynamicEffectInvokeSource < States , Events , Emits , StateId , Source >
6370+ & {
6371+ readonly onDone : DynamicEffectDoneHandler < States , Events , Emits , StateId , Source >
6372+ readonly onFailure : DynamicEffectFailureHandler < States , Events , Emits , StateId , Source >
6373+ } ,
6374+ ..._validation : InvokeChannelIsNever < Effect . Success < ReturnType < Source > > > extends true ? [
6375+ "onDone must be omitted when the Effect output is never"
6376+ ]
6377+ : InvokeChannelIsNever < Effect . Error < ReturnType < Source > > > extends true ? [
6378+ "onFailure must be omitted when the Effect error is never"
6379+ ]
6380+ : [ ]
6381+ ) : DynamicEffectInvokeResult < States , Events , Emits , StateId , Source >
6382+ <
6383+ const States extends Machine . StateSchemas ,
6384+ const Events extends ReadonlyArray < Machine . TaggedSchema > ,
6385+ const Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6386+ StateId extends Machine . StateIdentifier < States > ,
6387+ const Source extends (
6388+ context : Machine . InvokeContext < States , Events , Emits , StateId >
6389+ ) => Effect . Effect < unknown , never , unknown >
6390+ > (
6391+ config :
6392+ & DynamicEffectInvokeSource < States , Events , Emits , StateId , Source >
6393+ & {
6394+ readonly onDone : DynamicEffectDoneHandler < States , Events , Emits , StateId , Source >
6395+ readonly onFailure ?: never
6396+ } ,
6397+ ..._validation : InvokeChannelIsNever < Effect . Success < ReturnType < Source > > > extends true ? [
6398+ "onDone must be omitted when the Effect output is never"
6399+ ]
6400+ : [ ]
6401+ ) : DynamicEffectInvokeResult < States , Events , Emits , StateId , Source >
6402+ <
6403+ const States extends Machine . StateSchemas ,
6404+ const Events extends ReadonlyArray < Machine . TaggedSchema > ,
6405+ const Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6406+ StateId extends Machine . StateIdentifier < States > ,
6407+ const Source extends (
6408+ context : Machine . InvokeContext < States , Events , Emits , StateId >
6409+ ) => Effect . Effect < never , unknown , unknown >
6410+ > (
6411+ config :
6412+ & DynamicEffectInvokeSource < States , Events , Emits , StateId , Source >
6413+ & {
6414+ readonly onDone ?: never
6415+ readonly onFailure : DynamicEffectFailureHandler < States , Events , Emits , StateId , Source >
6416+ } ,
6417+ ..._validation : InvokeChannelIsNever < Effect . Error < ReturnType < Source > > > extends true ? [
6418+ "onFailure must be omitted when the Effect error is never"
6419+ ]
6420+ : [ ]
6421+ ) : DynamicEffectInvokeResult < States , Events , Emits , StateId , Source >
6422+ <
6423+ const States extends Machine . StateSchemas ,
6424+ const Events extends ReadonlyArray < Machine . TaggedSchema > ,
6425+ const Emits extends ReadonlyArray < Machine . TaggedSchema > ,
6426+ StateId extends Machine . StateIdentifier < States > ,
6427+ const Source extends (
6428+ context : Machine . InvokeContext < States , Events , Emits , StateId >
6429+ ) => Effect . Effect < never , never , unknown >
6430+ > (
6431+ config :
6432+ & DynamicEffectInvokeSource < States , Events , Emits , StateId , Source >
6433+ & {
6434+ readonly onDone ?: never
6435+ readonly onFailure ?: never
6436+ }
6437+ ) : DynamicEffectInvokeResult < States , Events , Emits , StateId , Source >
63176438 <
63186439 const States extends Machine . StateSchemas ,
63196440 const Events extends ReadonlyArray < Machine . TaggedSchema > ,
0 commit comments