Closed asheeshmathur closed 6 months ago
Please always try to share a repro case in a runnable form - either by providing a git repository to clone or a codesandbox. OSS maintainers usually can't afford the time to set up the repro, even if exact steps are given.
I think the problem here is lack of the strict mode in the consuming project and that’s a hard requirement for XState’s types to work. If you manage to repro this with strict mode enabled please let us know and we’ll reopen the issue
XState version
XState version 5
Description
Using TS v 5.4 planning to create standalone or backend application. With even with single import, statement getting following error ../node_modules/xstate/dist/declarations/src/State.d.ts:5:49 - error TS2344: Type 'NonNullable<TStateValue[K]>' does not satisfy the constraint 'StateValue'.
Am using following settings in tconfig.js "compilerOptions": { "strictNullChecks": true, "skipLibCheck": true, "lib": ["es2021", "DOM"], "target": "es2021",
Expected result
Success
Actual result
../node_modules/xstate/dist/declarations/src/State.d.ts:5:49 - error TS2344: Type 'NonNullable<TStateValue[K]>' does not satisfy the constraint 'StateValue'. "compilerOptions": { "strictNullChecks": true, "skipLibCheck": true, "lib": ["es2021", "DOM"], "target": "es2021",
Reproduction
XState 5
Additional context
No response