Skip to content

Commit 050e6a0

Browse files
committed
fix(types): missing any placeholder generics for AnyXstateTreeMachine
This cropped up as type errors for machines that had input and actions
1 parent d24eb9c commit 050e6a0

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

src/types.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,12 @@ export type XstateTreeMachine<
121121
/**
122122
* @public
123123
*/
124-
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine>;
124+
export type AnyXstateTreeMachine = XstateTreeMachine<
125+
AnyStateMachine,
126+
any,
127+
any,
128+
any[]
129+
>;
125130
/**
126131
* @internal
127132
*/

src/xstateTree.spec.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ describe("xstate-tree", () => {
6969
});
7070

7171
const XstateTreeMachine = createXStateTreeMachine(machine, {
72+
// Had a type error when adding in actions to this machine which has now been resolved
73+
// keeping it for sanity check
74+
actions() {
75+
return {
76+
foo() {},
77+
};
78+
},
7279
View: ({ selectors }) => {
7380
return <p>{selectors.foo}</p>;
7481
},

xstate-tree.api.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export type AnyRoute = {
4646
};
4747

4848
// @public (undocumented)
49-
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine>;
49+
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine, any, any, any[]>;
5050

5151
// @public (undocumented)
5252
export type ArgumentsForRoute<T> = T extends Route<infer TParams, infer TQuery, any, infer TMeta> ? RouteArguments<TParams, TQuery, TMeta> : never;
@@ -400,8 +400,8 @@ export type XstateTreeMachineStateSchemaV2<TMachine extends AnyStateMachine, TSe
400400
// src/routing/createRoute/createRoute.ts:285:19 - (ae-forgotten-export) The symbol "MergeRouteTypes" needs to be exported by the entry point index.d.ts
401401
// src/routing/createRoute/createRoute.ts:285:19 - (ae-forgotten-export) The symbol "ResolveZodType" needs to be exported by the entry point index.d.ts
402402
// src/routing/createRoute/createRoute.ts:322:9 - (ae-forgotten-export) The symbol "RouteRedirect" needs to be exported by the entry point index.d.ts
403-
// src/types.ts:137:3 - (ae-incompatible-release-tags) The symbol "canHandleEvent" is marked as @public, but its signature references "CanHandleEvent" which is marked as @internal
404-
// src/types.ts:138:3 - (ae-incompatible-release-tags) The symbol "inState" is marked as @public, but its signature references "MatchesFrom" which is marked as @internal
403+
// src/types.ts:142:3 - (ae-incompatible-release-tags) The symbol "canHandleEvent" is marked as @public, but its signature references "CanHandleEvent" which is marked as @internal
404+
// src/types.ts:143:3 - (ae-incompatible-release-tags) The symbol "inState" is marked as @public, but its signature references "MatchesFrom" which is marked as @internal
405405

406406
// (No @packageDocumentation comment for this package)
407407

0 commit comments

Comments
 (0)