xstate 6.0.0-alpha.5 → 6.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "./schema.types.js";
|
|
2
2
|
import { StateMachine } from "./StateMachine.js";
|
|
3
|
-
import { AnyActorRef, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, ToChildren, MetaObject, Cast, Compute } from "./types.js";
|
|
3
|
+
import { AnyActorRef, AnyStateNode, EventObject, AnyEventObject, EventDescriptor, ExtractEvent, MachineContext, ProvidedActor, RoutableStateId, StateSchema, StateValue, ToChildren, MetaObject, Cast, Compute, EnqueueObject } from "./types.js";
|
|
4
4
|
import { DelayMapFromNames, InferChildren, Implementations, InferOutput, InferEvents, Next_MachineConfig, Next_StateNodeConfig, WithDefault } from "./types.v6.js";
|
|
5
5
|
type SetupConfig<TSchemas extends SetupSchemas, TStates extends Record<string, SetupStateSchema>, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> = {
|
|
6
6
|
schemas?: TSchemas;
|
|
@@ -196,7 +196,7 @@ type StateTransitionConfigOrTarget<TStateSchemas extends Record<string, SetupSta
|
|
|
196
196
|
event: TExpressionEvent;
|
|
197
197
|
}) => Record<string, unknown>);
|
|
198
198
|
} | StateTransitionFunction<TStateSchemas, TContext, TExpressionEvent, TEvent, TEmitted, TChildren, TMeta, TActionMap, TActorMap, TGuardMap, TDelayMap>;
|
|
199
|
-
type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TExpressionEvent extends EventObject,
|
|
199
|
+
type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TExpressionEvent extends EventObject, TEvent extends EventObject, TEmitted extends EventObject, TChildren extends Record<string, AnyActorRef | undefined>, TMeta extends MetaObject, TActionMap extends Implementations['actions'], TActorMap extends Implementations['actors'], TGuardMap extends Implementations['guards'], TDelayMap extends Implementations['delays']> = (args: {
|
|
200
200
|
context: TContext;
|
|
201
201
|
event: TExpressionEvent;
|
|
202
202
|
self: AnyActorRef;
|
|
@@ -207,7 +207,7 @@ type StateTransitionFunction<TStateSchemas extends Record<string, SetupStateSche
|
|
|
207
207
|
actors: TActorMap;
|
|
208
208
|
guards: TGuardMap;
|
|
209
209
|
delays: TDelayMap;
|
|
210
|
-
}, enq:
|
|
210
|
+
}, enq: EnqueueObject<TEvent, TEmitted>) => StateTransitionResult<TStateSchemas, TContext, TMeta> | void;
|
|
211
211
|
type StateTransitionResult<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TMeta extends MetaObject> = {
|
|
212
212
|
target?: never;
|
|
213
213
|
context?: TContext;
|
|
@@ -216,14 +216,17 @@ type StateTransitionResult<TStateSchemas extends Record<string, SetupStateSchema
|
|
|
216
216
|
} | {
|
|
217
217
|
[K in keyof TStateSchemas & string]: {
|
|
218
218
|
target: K;
|
|
219
|
-
context: StateContext<TStateSchemas[K], TContext>;
|
|
220
219
|
reenter?: boolean;
|
|
221
220
|
meta?: TMeta;
|
|
222
221
|
input?: StateInput<TStateSchemas[K]> | ((args: {
|
|
223
222
|
context: TContext;
|
|
224
223
|
event: EventObject;
|
|
225
224
|
}) => StateInput<TStateSchemas[K]>);
|
|
226
|
-
}
|
|
225
|
+
} & ([TContext] extends [StateContext<TStateSchemas[K], TContext>] ? {
|
|
226
|
+
context?: StateContext<TStateSchemas[K], TContext>;
|
|
227
|
+
} : {
|
|
228
|
+
context: StateContext<TStateSchemas[K], TContext>;
|
|
229
|
+
});
|
|
227
230
|
}[keyof TStateSchemas & string];
|
|
228
231
|
/** Initial transition with typed input based on target state */
|
|
229
232
|
type InitialTransitionWithInput<TStateSchemas extends Record<string, SetupStateSchema>, TContext extends MachineContext, TEvent extends EventObject> = {
|