We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When the action function is used for an async callback property a type error occurs e.g.
action
Stackblitz reproduction: https://stackblitz.com/edit/github-u61rhv?file=stories%2FButton.stories.ts
Environment Info: System: OS: Windows 10 10.0.22621 CPU: (8) x64 Intel(R) Core(TM) i5-10300H CPU @ 2.50GHz Binaries: Node: 18.12.1 - C:\Program Files\nodejs\node.EXE Yarn: 3.2.4 - C:\Program Files (x86)\Yarn\bin\yarn.CMD npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD Browsers: Chrome: 115.0.5790.110 Edge: Spartan (44.22621.1992.0), Chromium (115.0.1901.188) npmPackages: @storybook/addon-essentials: ^7.2.0 => 7.2.0 @storybook/addon-interactions: ^7.2.0 => 7.2.0 @storybook/addon-links: ^7.2.0 => 7.2.0 @storybook/blocks: ^7.2.0 => 7.2.0 @storybook/nextjs: ^7.2.0 => 7.2.0 @storybook/react: ^7.2.0 => 7.2.0 @storybook/testing-library: ^0.2.0 => 0.2.0
I think its a case of setting the return type for the HandlerFunction here https://github.com/storybookjs/storybook/blob/next/code/addons/actions/src/models/HandlerFunction.ts to any (unknown or void|Promise<void> doesnt work)
any
unknown
void|Promise<void>
The text was updated successfully, but these errors were encountered:
I had a similar issue, and, in case it is helpful, the following is an ok workaround:
const meta = { args: { asyncHandler: async (...args) => { action('async-handler')(args) }, }, component: Component, }
Sorry, something went wrong.
No branches or pull requests
Describe the bug
When the
action
function is used for an async callback property a type error occurs e.g.To Reproduce
Stackblitz reproduction: https://stackblitz.com/edit/github-u61rhv?file=stories%2FButton.stories.ts
System
Additional context
I think its a case of setting the return type for the HandlerFunction here https://github.com/storybookjs/storybook/blob/next/code/addons/actions/src/models/HandlerFunction.ts to
any
(unknown
orvoid|Promise<void>
doesnt work)The text was updated successfully, but these errors were encountered: