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
Hey folks. Getting a type error in xstate v5.17.0 when passing a few of my machines to useMachine from @xstate/react, but not all of them - can't quite figure out what's different enough between them to nail down the culprit. Is it obvious to you based on this error?
Expected result
No type errors.
Actual result
Argument of type 'StateMachine<CheatCodeContext, KeydownEvent, {}, never, Values<{ record: { type: "record"; params: NonReducibleUnknown; }; resetTypedKeys: { ...; }; }>, ... 8 more ..., { ...; }>' is not assignable to parameter of type 'AnyStateMachine'.
The types returned by 'resolveState(...)' are incompatible between these types.
Type 'MachineSnapshot<CheatCodeContext, KeydownEvent, {}, { disabled?: "idle" | "recording" | undefined; enabled?: "idle" | "recording" | undefined; }, string, NonReducibleUnknown, MetaObject, { ...; }>' is not assignable to type 'MachineSnapshot<any, any, any, any, any, any, any, StateSchema>'.
Type 'ActiveMachineSnapshot<CheatCodeContext, KeydownEvent, {}, { disabled?: "idle" | "recording" | undefined; enabled?: "idle" | "recording" | undefined; }, string, NonReducibleUnknown, MetaObject, { ...; }>' is not assignable to type 'MachineSnapshot<any, any, any, any, any, any, any, StateSchema>'.
Type 'ActiveMachineSnapshot<CheatCodeContext, KeydownEvent, {}, { disabled?: "idle" | "recording" | undefined; enabled?: "idle" | "recording" | undefined; }, string, NonReducibleUnknown, MetaObject, { ...; }>' is not assignable to type 'ActiveMachineSnapshot<any, any, any, any, any, any, any, StateSchema>'.
The types returned by 'getMeta()' are incompatible between these types.
Property '"(machine)"' is missing in type 'Record<"cheatCodeMachine" | "cheatCodeMachine.disabled" | "cheatCodeMachine.disabled.idle" | "cheatCodeMachine.disabled.recording" | "cheatCodeMachine.enabled" | "cheatCodeMachine.enabled.idle" | "cheatCodeMachine.enabled.recording", MetaObject | undefined>' but required in type 'Record<"(machine)", any>'.ts(2345)
* Add failing test
* Merge
* Make all StateMachine type params required
* Changeset?
* Update packages/core/src/types.ts
* Don't need the any check after all
XState version
XState version 5
Description
Hey folks. Getting a type error in xstate v5.17.0 when passing a few of my machines to
useMachine
from@xstate/react
, but not all of them - can't quite figure out what's different enough between them to nail down the culprit. Is it obvious to you based on this error?Expected result
No type errors.
Actual result
Reproduction
https://github.com/wKovacs64/use-secret-code/blob/074b6fa0aadf7abd21edcffe3a4ea040f64200bb/src/index.ts
Additional context
Happy to provide more info if needed, but this feels like something you're going to eyeball and know right away. 🙂 Thanks.
The text was updated successfully, but these errors were encountered: