-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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]: 7.0.0 - Module '"@storybook/addon-actions/decorator"' has no exported member 'withActions' #21887
Comments
@jattasNI thanks for re-filing the issue and for the detailed backstory. we'll see if we can get to the bottom of it. in the meantime can you declare the module as a workaround?
|
@ndelangen we have stories for this in https://github.com/storybookjs/storybook/blob/next/code/addons/actions/template/stories/parameters.stories.ts, but they are also producing a TS error in VScode. Mind taking a look? |
@shilman thanks for the workaround, it does work for us! In case it helps others, the full picture that worked with our TypeScript configuration was to add a new declaration file containing the workaround, declare module '@storybook/addon-actions/decorator'; And then import and use import { withActions } from '@storybook/addon-actions/decorator';
...
{
decorators: [withActions],
} Once this issue is addressed hopefully we can just delete the new declaration file. |
# Pull Request ## 🤨 Rationale After #1134, the Actions tab in Storybook was no longer displaying events fired by components. This is one of the issues tracked in #1146. As described in the [Storybook 7 migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#removed-auto-injection-of-storybookaddon-actions-decorator), the actions addon is no longer enabled by default and it must be enabled by configuring the story with `decorators: [withActions]`. However, the `withActions` decorator wasn't exported from Storybook in a way that we could import it (see storybookjs/storybook#21887). A Storybook dev commented on that issue with a workaround that we can use until they fix that bug. ## 👩💻 Implementation 1. Add a [TypeScript shorthand ambient module declaration](https://www.typescriptlang.org/docs/handbook/modules.html#shorthand-ambient-modules) for the import URL that contains `withActions`. See `/utilities/tests/storybook-declarations.d.ts`. 2. Update all stories that expose an action to import `withActions` and configure it as a decorator (also reordered a few imports to group them by package) ## 🧪 Testing Manually verified many of the stories that have actions are now firing them. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.0 containing PR #21922 that references this issue. Upgrade today to the
|
Huzzah!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.3 containing PR #21922 that references this issue. Upgrade today to the
|
# Pull Request ## 🤨 Rationale Right after I submitted the upgrade to a release candidate of Storybook 7 in #1134, I noticed they [released the official 7.0.0](https://github.com/storybookjs/storybook/releases). Adopting the latest patch addresses some of the issues in #1146. ## 👩💻 Implementation 1. Update to latest non-RC build in package.json and regenerate package-lock.json 2. Regenerate one patch file since the file it was patching has a new name 3. Add another patch file since they introduced another instance of storybookjs/storybook#21820 4. Move off deprecated API for specifying `sourceTransform` as described in [migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#source-block) 5. Delete `storybook-declarations.ts` since this bug was closed storybookjs/storybook#21887 ## 🧪 Testing Explored Storybook. ## ✅ Checklist - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
Describe the bug
According to the 7.0 migration guide I should be able to use the
withActions
decorator viaimport { withActions } from '@storybook/addon-actions/decorator';
. But when I run TypeScript compile this gives me "error TS2305: Module '"@storybook/addon-actions/decorator"' has no exported member 'withActions'."It looks like
withActions
is exported fromaddons/actions/src/decorator.ts
but is not exported fromaddons/actions/src/index.ts
. This differs from other decorators likewithLinks
which are exported from their index.ts.It looks like this is intended to work via the "exports" field in
package.json
for declaring multiple entry points inpackage.json
. That feature gained support in TypeScript 4.7.0. But I tried upgrading my project from TypeScript 4.6.4 to 4.7.0 and still saw the same error.To Reproduce
This is reproducing in this branch of the ni/nimble repository. To reproduce, clone that repo, checkout that branch, run
npm i
andnpm run build
. If a more targeted reproduction would be helpful I can try to create one.System
Additional context
This was also reported in #21308 but that bug is marked as fixed and I'm still seeing the problem. I don't have permission to re-open that issue and I was worried my comment there would get lost so I filed a new one; sorry if that's not the correct workflow!
The text was updated successfully, but these errors were encountered: