xstate 5.17.2 → 5.17.4
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,4 +1,4 @@
|
|
|
1
|
-
import { ActionArgs, EventObject, MachineContext,
|
|
1
|
+
import { ActionArgs, ActionFunction, AnyEventObject, DoNotInfer, EventObject, MachineContext, ParameterizedObject, SendExpr } from "../types.js";
|
|
2
2
|
export interface EmitAction<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TEmitted extends EventObject> {
|
|
3
3
|
(args: ActionArgs<TContext, TExpressionEvent, TEvent>, params: TParams): void;
|
|
4
4
|
_out_TEmitted?: TEmitted;
|
|
@@ -39,6 +39,6 @@ export interface EmitAction<TContext extends MachineContext, TExpressionEvent ex
|
|
|
39
39
|
* // }
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare function emit<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TEmitted extends
|
|
42
|
+
export declare function emit<TContext extends MachineContext, TExpressionEvent extends EventObject, TParams extends ParameterizedObject['params'] | undefined, TEvent extends EventObject, TEmitted extends AnyEventObject>(
|
|
43
43
|
/** The event to emit, or an expression that returns an event to emit. */
|
|
44
|
-
eventOrExpr: TEmitted | SendExpr<TContext, TExpressionEvent, TParams, TEmitted
|
|
44
|
+
eventOrExpr: DoNotInfer<TEmitted> | SendExpr<TContext, TExpressionEvent, TParams, DoNotInfer<TEmitted>, TEvent>): ActionFunction<TContext, TExpressionEvent, TEvent, TParams, never, never, never, never, TEmitted>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AnyActorRef, AnyEventObject, AnyTransitionDefinition, Snapshot } from "./types.js";
|
|
1
|
+
import { ActorRefLike, AnyActorRef, AnyEventObject, AnyTransitionDefinition, Snapshot } from "./types.js";
|
|
2
2
|
export type InspectionEvent = InspectedSnapshotEvent | InspectedEventEvent | InspectedActorEvent | InspectedMicrostepEvent | InspectedActionEvent;
|
|
3
3
|
interface BaseInspectionEventProperties {
|
|
4
4
|
rootId: string;
|
|
@@ -9,7 +9,7 @@ interface BaseInspectionEventProperties {
|
|
|
9
9
|
* - For event events, this is the target `actorRef` (recipient of event).
|
|
10
10
|
* - For actor events, this is the `actorRef` of the registered actor.
|
|
11
11
|
*/
|
|
12
|
-
actorRef:
|
|
12
|
+
actorRef: ActorRefLike;
|
|
13
13
|
}
|
|
14
14
|
export interface InspectedSnapshotEvent extends BaseInspectionEventProperties {
|
|
15
15
|
type: '@xstate.snapshot';
|
|
@@ -760,6 +760,7 @@ export interface ActorRef<TSnapshot extends Snapshot<unknown>, TEvent extends Ev
|
|
|
760
760
|
})) => void) => Subscription;
|
|
761
761
|
}
|
|
762
762
|
export type AnyActorRef = ActorRef<any, any, any>;
|
|
763
|
+
export type ActorRefLike = Pick<AnyActorRef, 'sessionId' | 'send' | 'getSnapshot'>;
|
|
763
764
|
export type UnknownActorRef = ActorRef<Snapshot<unknown>, EventObject>;
|
|
764
765
|
export type ActorLogicFrom<T> = ReturnTypeOrValue<T> extends infer R ? R extends StateMachine<any, any, any, any, any, any, any, any, any, any, any, any, any, // TMeta
|
|
765
766
|
any> ? R : R extends Promise<infer U> ? PromiseActorLogic<U> : never : never;
|
|
@@ -899,6 +900,18 @@ export type ToChildren<TActor extends ProvidedActor> = string extends TActor['sr
|
|
|
899
900
|
export type StateSchema = {
|
|
900
901
|
id?: string;
|
|
901
902
|
states?: Record<string, StateSchema>;
|
|
903
|
+
type?: unknown;
|
|
904
|
+
invoke?: unknown;
|
|
905
|
+
on?: unknown;
|
|
906
|
+
entry?: unknown;
|
|
907
|
+
exit?: unknown;
|
|
908
|
+
onDone?: unknown;
|
|
909
|
+
after?: unknown;
|
|
910
|
+
always?: unknown;
|
|
911
|
+
meta?: unknown;
|
|
912
|
+
output?: unknown;
|
|
913
|
+
tags?: unknown;
|
|
914
|
+
description?: unknown;
|
|
902
915
|
};
|
|
903
916
|
export type StateId<TSchema extends StateSchema, TKey extends string = '(machine)', TParentKey extends string | null = null> = (TSchema extends {
|
|
904
917
|
id: string;
|