Skip to content

Commit ad809a0

Browse files
authored
[core] Export types so setup() declaration emit works (#5464)
* Export types so setup() declaration emit works (fixes #5462) * Changeset
1 parent 87e980d commit ad809a0

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

.changeset/every-mammals-live.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'xstate': patch
3+
---
4+
5+
Fix: export types so setup() declaration emit works (fixes #5462)

packages/core/src/actions.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,9 @@ export {
1717
sendTo,
1818
type SendToAction
1919
} from './actions/send.ts';
20-
export { spawnChild, type SpawnAction } from './actions/spawnChild.ts';
20+
export {
21+
spawnChild,
22+
type SpawnAction,
23+
type SpawnActionOptions
24+
} from './actions/spawnChild.ts';
2125
export { stop, stopChild, type StopAction } from './actions/stopChild.ts';

packages/core/src/actions/spawnChild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ export interface SpawnAction<
127127
_out_TActor?: TActor;
128128
}
129129

130-
interface SpawnActionOptions<
130+
export interface SpawnActionOptions<
131131
TContext extends MachineContext,
132132
TExpressionEvent extends EventObject,
133133
TEvent extends EventObject,

packages/core/src/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export {
1111
export { createMachine } from './createMachine.ts';
1212
export { getInitialSnapshot, getNextSnapshot } from './getNextSnapshot.ts';
1313
export { and, not, or, stateIn } from './guards.ts';
14+
export type { GuardPredicate, GuardArgs } from './guards.ts';
1415
export type {
1516
InspectedActionEvent,
1617
InspectedActorEvent,
@@ -19,7 +20,7 @@ export type {
1920
InspectedSnapshotEvent,
2021
InspectionEvent
2122
} from './inspection.ts';
22-
export { setup } from './setup.ts';
23+
export { setup, type SetupReturn } from './setup.ts';
2324
export { SimulatedClock } from './SimulatedClock.ts';
2425
export { type Spawner } from './spawn.ts';
2526
export { isMachineSnapshot, type MachineSnapshot } from './State.ts';

packages/core/src/setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ type ToStateSchema<TSchema extends StateSchema> = {
7878
type RequiredSetupKeys<TChildrenMap> =
7979
IsNever<keyof TChildrenMap> extends true ? never : 'actors';
8080

81-
type SetupReturn<
81+
export type SetupReturn<
8282
TContext extends MachineContext,
8383
TEvent extends AnyEventObject,
8484
TActors extends Record<string, UnknownActorLogic>,

0 commit comments

Comments
 (0)