You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I expected the typings to be built without issues.
Actual result
When trying to build types for the packages, I get the following error:
src/my-machine.ts:3:14 - error TS2742: The inferred type of 'myMachine' cannot be named without a reference to '../../../node_modules/xstate/dist/declarations/src/guards'. This is likely not portable. A type annotation is necessary.
3 export const myMachine = setup({
It seems like the issue stems from the not function referencing the GuardPredicate type which is not exported by XState and TypeScript is unable to build a type for it without this reference.
Try running pnpm run build in the reproduction and you will see the error. For some reason, the error doesn't occur when using...
"moduleResolution": "node",
...in tsconfig.json. But that doesn't seem like a viable solution as that causes other module issues and is not really recommended by TS at this point.
The text was updated successfully, but these errors were encountered:
XState version
XState version 5
Description
I'm trying to create a package that creates a reusable state machine. I've simplified our machine to locate the error being the
not
function:Expected result
I expected the typings to be built without issues.
Actual result
When trying to build types for the packages, I get the following error:
It seems like the issue stems from the
not
function referencing theGuardPredicate
type which is not exported by XState and TypeScript is unable to build a type for it without this reference.Reproduction
https://codesandbox.io/p/devbox/angry-goldberg-v42j8m?workspaceId=4a3e8946-02ff-4af1-aeb6-deeb01d9e58a
Additional context
Try running
pnpm run build
in the reproduction and you will see the error. For some reason, the error doesn't occur when using......in tsconfig.json. But that doesn't seem like a viable solution as that causes other module issues and is not really recommended by TS at this point.
The text was updated successfully, but these errors were encountered: