-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
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
[Bug]: decorators
causes TS error
#24656
Comments
Do you a have a reproduction repo you can share? If not, can you create one? Go to https://storybook.new or see repro docs. Thank you! 🙏 |
I have the same issue. |
Also having the same issue on v7.6.2. This is on a fresh project. Unfortunately, @emlai's workaround of using |
After installing @storybook/types as a dev dependency and adding the import to a types.ts file in the root (anywhere in the project out of sight should work) the error went away for me. |
I have the same issue, workarounds didn't work for me. import type { Meta } from "@storybook/react";
const meta: Meta<typeof Icon> = {
component: Icon,
decorators: [
Story => (
<div style={{ margin: '3em' }}>
<Story />
</div>
),
],
};
export default meta; |
I have the same issue 🙏🏻 |
I can not reproduce this, can you check if this error still happens in the latest storybook, and maybe a stackblitz repro? @emlai |
I have the same issue @YouHusam 's workaround fixed it for me |
@generatorpoint Could you make a stackblitz reproduction. I can not reproduce this issue. |
It is easy to reproduce it in a |
@valentinpalkovic is that because there is some type leaking from |
So the |
I can only reproduce this when setting "declaration": true,
"noEmit": false, in tsconfig @emlai Are you trying to build TS declaration files for You can achieve this by using a different |
@kylegach @vanessayuenn Discussed with @shilman that this is not a blocker for RC. I think this issue is best solved by instructing people how to exclude |
potentially related to #25170 |
Had the same issue in Storybook v8.3.6. I solved this by rewriting the code so that it's structured the same way as the example in Storybook docs. Without testing the code provided in this issue, it would be: const meta: Meta<typeof Icon> = {
component: Icon,
decorators: [
Story => (
<div style={{ margin: '3em' }}>
<Story />
</div>
),
],
};
export default meta; It seems refactoring to drop |
Describe the bug
Following the code from the docs, I get a TS error:
To Reproduce
If I remove
decorators
, the error goes away.System
System: OS: macOS 13.5 CPU: (12) arm64 Apple M2 Pro Shell: 5.9 - /bin/zsh Binaries: Node: 20.8.1 - /opt/homebrew/bin/node npm: 10.1.0 - /opt/homebrew/bin/npm pnpm: 8.6.8 - /opt/homebrew/bin/pnpm <----- active Browsers: Chrome: 118.0.5993.117 Safari: 16.6
Additional context
TypeScript version is 5.2.2.
Adding
import type {} from "@storybook/types"
is a workaround but ideally it would not be required.The text was updated successfully, but these errors were encountered: