ChrisShank / xstate-vue2

Vue 2 composables for XState.
MIT License
19 stars 5 forks source link

xstate-vue2 and typegen #9

Open blocka opened 1 year ago

blocka commented 1 year ago

I'm having trouble getting these two to play together.

See here: https://codesandbox.io/p/sandbox/gallant-fire-w4nv51


const machine: StateMachine<{
    value: string;
}, any, {
    type: "FOO";
    value: string;
} | {
    type: "BAR";
}, {
    value: any;
    context: {
        value: string;
    };
}, BaseActionObject, ServiceMap, ResolveTypegenMeta<Typegen0, {
    type: "FOO";
    value: string;
} | {
    type: "BAR";
}, BaseActionObject, ServiceMap>>
Argument of type 'StateMachine<{ value: string; }, any, { type: "FOO"; value: string; } | { type: "BAR"; }, { value: any; context: { value: string; }; }, BaseActionObject, ServiceMap, ResolveTypegenMeta<Typegen0, { ...; } | { ...; }, BaseActionObject, ServiceMap>>' is not assignable to parameter of type 'MaybeLazy<StateMachine<{ value: string; }, any, { type: "FOO"; value: string; } | { type: "BAR"; }, { value: any; context: { value: string; }; }, BaseActionObject, ServiceMap, ResolveTypegenMeta<...>>>'.
  Type 'StateMachine<{ value: string; }, any, { type: "FOO"; value: string; } | { type: "BAR"; }, { value: any; context: { value: string; }; }, BaseActionObject, ServiceMap, ResolveTypegenMeta<Typegen0, { ...; } | { ...; }, BaseActionObject, ServiceMap>>' is not assignable to type 'StateMachine<{ value: string; }, any, { type: "FOO"; value: string; } | { type: "BAR"; }, { value: any; context: { value: string; }; }, BaseActionObject, ServiceMap, ResolveTypegenMeta<TypegenDisabled, { ...; } | { ...; }, BaseActionObject, ServiceMap>>'.
    The types of 'withConfig(...).__TResolvedTypesMeta' are incompatible between these types.
      Type 'MarkAllImplementationsAsProvided<ResolveTypegenMeta<Typegen0, { type: "FOO"; value: string; } | { type: "BAR"; }, BaseActionObject, ServiceMap>>' is not assignable to type 'ResolveTypegenMeta<TypegenDisabled, { type: "FOO"; value: string; } | { type: "BAR"; }, BaseActionObject, ServiceMap>'.typescript(2345)```
ChrisShank commented 1 year ago

Hi! This package has not been updated to work with typegen yet as that was a pretty significant breaking change to xstate's types and no one has requested it for this package before. I'm more than happy to review a PR if you want to contribute. It would probably take a week or two to add otherwise...