Having this code:
import { assign, setup } from "xstate"
const increase = assign({
counter: ({ context }) => context.counter + 1,
})const counterMachine = setup({
types: {
context: {} as {
counter: number
},
},
actions: {
increase,
},
}).createMachine({
context: {
counter: 0,
},
entry: { type: "increase" },
})
Why is typescript yelling at me (hovering over increase) and saying: "Types of property '_out_TActor' are incompatible. Type 'ProvidedActor | undefined' is not assignable to type '{ src: string; logic: UnknownActorLogic; id: string | undefined; } | undefined'. Type 'ProvidedActor' is not assignable to type '{ src: string; logic: UnknownActorLogic; id: string | undefined; }'. Property 'id' is optional in type 'ProvidedActor' but required in type '{ src: string; logic: UnknownActorLogic; id: string | undefined; }'.ts(2322)"
Is there a good practice to import an action here and not having typescript yelling?
Thanks for your good work 🙂