XState version
XState version 5
Description
I'd expect to get TS errors for this code:
const feedbackMachine = setup({
types: {
context: {} as { feedback: string },
events: {} as { type: "feedback.good" } | { type: "feedback.bad" },
},
}).createMachine({
context: {
feedback: "",
},
initial: "NON_EXISTING_STATE", // <---- i'd expect a TS error here
states: {
idle: {
on: {
"feedback.good": {
target: "NON_EXISTING_STATE", // <---- i'd expect a TS error here
},
},
},
},
});
Expected result
I should only be allowed to pass valid state values (in my example only idle) to the initial and target fields
Actual result
I'm allowed to pass a non existing state value to the initial and target fields, which then yields runtime errors
Reproduction
https://codesandbox.io/p/devbox/great-leavitt-fw32ld?file=%2Fsrc%2FfeedbackMachine.ts%3A10%2C69
Additional context
No response
XState version
XState version 5
Description
I'd expect to get TS errors for this code:
Expected result
I should only be allowed to pass valid state values (in my example only
idle) to theinitialandtargetfieldsActual result
I'm allowed to pass a non existing state value to the
initialandtargetfields, which then yields runtime errorsReproduction
https://codesandbox.io/p/devbox/great-leavitt-fw32ld?file=%2Fsrc%2FfeedbackMachine.ts%3A10%2C69
Additional context
No response