Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Bug: Unable to defineinvoke without providing actors #5254

Open
Assignees
Andarist
@Sebastian-G

Description

@Sebastian-G

XState version

XState version 5

Description

Hi, I'm currently facing an issue with theinvoke section of a state.
For some reason, it is not possible to add any information in my current installed version"xstate": "^5.19.2", and"typescript": "^5.6.3",.
I always end up with the following Typescript issue.

TS2353: Object literal may only specify known properties, and src does not exist in type readonly never[]types.d.ts(285, 5): The expected type comes from property invoke which is declared here on type

Is it any unknown bug in the type definitions, or is it just the wrong place?

I needed to add a fake actor to use theinvoke statement for adding a callback inline.

see:

constmachine=setup({actors:{// FIXME: This is a workaround to make the `invoke` work and fix `never` type issues.fake:{}asany,},}).createMachine({//...states:{//...exampleState:{invoke:{src:fromCallback(({ sendBack, self, input, system})=>{//...}),},},},});

Expected result

constmachine=setup({//...}).createMachine({//...states:{//...exampleState:{invoke:{src:fromCallback(({ sendBack, self, input, system})=>{//...}),},},},});

Actual result

TS2353: Object literal may only specify known properties, and src does not exist in type readonly never[]types.d.ts(285, 5): The expected type comes from property invoke which is declared here on type

Reproduction

https://stackblitz.com/edit/github-xtgithyn?file=src%2FfeedbackMachine.ts&view=editor

Additional context

"xstate": "^5.19.2",

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp