Skip to content

Commit

Permalink
fix(types): missing any placeholder generics for AnyXstateTreeMachine
Browse files Browse the repository at this point in the history
This cropped up as type errors for machines that had input and actions
  • Loading branch information
UberMouse committed Mar 5, 2024
1 parent d24eb9c commit 050e6a0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
7 changes: 6 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,12 @@ export type XstateTreeMachine<
/**
* @public
*/
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine>;
export type AnyXstateTreeMachine = XstateTreeMachine<
AnyStateMachine,
any,
any,
any[]
>;
/**
* @internal
*/
Expand Down
7 changes: 7 additions & 0 deletions src/xstateTree.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ describe("xstate-tree", () => {
});

const XstateTreeMachine = createXStateTreeMachine(machine, {
// Had a type error when adding in actions to this machine which has now been resolved
// keeping it for sanity check
actions() {
return {
foo() {},
};
},
View: ({ selectors }) => {
return <p>{selectors.foo}</p>;
},
Expand Down
6 changes: 3 additions & 3 deletions xstate-tree.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type AnyRoute = {
};

// @public (undocumented)
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine>;
export type AnyXstateTreeMachine = XstateTreeMachine<AnyStateMachine, any, any, any[]>;

// @public (undocumented)
export type ArgumentsForRoute<T> = T extends Route<infer TParams, infer TQuery, any, infer TMeta> ? RouteArguments<TParams, TQuery, TMeta> : never;
Expand Down Expand Up @@ -400,8 +400,8 @@ export type XstateTreeMachineStateSchemaV2<TMachine extends AnyStateMachine, TSe
// src/routing/createRoute/createRoute.ts:285:19 - (ae-forgotten-export) The symbol "MergeRouteTypes" needs to be exported by the entry point index.d.ts
// src/routing/createRoute/createRoute.ts:285:19 - (ae-forgotten-export) The symbol "ResolveZodType" needs to be exported by the entry point index.d.ts
// src/routing/createRoute/createRoute.ts:322:9 - (ae-forgotten-export) The symbol "RouteRedirect" needs to be exported by the entry point index.d.ts
// 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
// 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
// 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
// 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

// (No @packageDocumentation comment for this package)

Expand Down

0 comments on commit 050e6a0

Please sign in to comment.