Skip to content
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

SB 5.2 Typescript build fail - (Addon-knobs) #8105

Closed
sami616 opened this issue Sep 17, 2019 · 15 comments · Fixed by #8118
Closed

SB 5.2 Typescript build fail - (Addon-knobs) #8105

sami616 opened this issue Sep 17, 2019 · 15 comments · Fixed by #8118
Labels
addon: knobs bug patch:yes Bugfix & documentation PR that need to be picked to main branch react typescript

Comments

@sami616
Copy link

sami616 commented Sep 17, 2019

I'm running into a couple of issues when updating to 5.2.

Both errors seem to be caused by the addon knobs package.

  1. Complains about a missing dep (manually installing @types/react-color fixes this one)
ERROR in [at-loader] ./node_modules/@storybook/addon-knobs/dist/components/types/Color.d.ts:3:29 
    TS7016: Could not find a declaration file for module 'react-color'. '/Users/sami/Apps/components/node_modules/react-color/lib/index.js' implicitly has an 'any' type.
  Try `npm install @types/react-color` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-color';`
  1. Second complains about a missing export
ERROR in [at-loader] ./node_modules/@types/storybook__addon-knobs/index.d.ts:13:10 
    TS2305: Module '"../../../../../../../Users/sami/Apps/components/node_modules/@storybook/react/dist/client"' has no exported member 'RenderFunction'.
@pachtymi
Copy link

I believe that fix only fixes 1) but doesn't fix 2)

@hipstersmoothie
Copy link
Contributor

TS2305: Module '"../../../../../../../Users/sami/Apps/components/node_modules/@storybook/react/dist/client"' has no exported member 'RenderFunction'.

This is because @sami616 is using @types/storybook__addon-knobs. Those types are now included with the package

@hipstersmoothie
Copy link
Contributor

They can delete the dep on those types now.

@pachtymi
Copy link

ah, makes sense. 👍

@sami616
Copy link
Author

sami616 commented Sep 19, 2019

Can confirm the RenderFunction error has gone now that i have uninstalled @types/storybook__addon-knobs - still seeing the react-color one though!

Am i right in thinking @types/storybook__react is now also not needed?

@tatsushitoji
Copy link

@types/storybook__react is now also not needed?

i think so.
but still seeing webpack-env when i have uninstall @types/storybook__react.

shilman added a commit that referenced this issue Sep 21, 2019
add missing type def to addon-knobs fixes #8105
@shilman
Copy link
Member

shilman commented Sep 24, 2019

Yippee!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.1 containing PR #8118 that references this issue. Upgrade today to try it out!

You can find this prerelease on the @next NPM tag.

@sami616
Copy link
Author

sami616 commented Sep 24, 2019

Thanks @shilman just upgraded and tried running my app, and the build is failing with the following error:

Module not found: Error: Can't resolve '@storybook/core/client' in '/Users/sami/Apps/components/node_modules/@storybook/react/dist/client/preview'

I could probably just manually install the dep to resolve but thought its worth pointing out anyway!

@shilman
Copy link
Member

shilman commented Sep 24, 2019

@sami616 Ergh. Will release a fix in the next hr

@jamie--stewart
Copy link

Hi, did you get a chance to release that fix? ☝️

No worries if not, happy to work-around for just now. Was very happy to find this issue!

@sami616
Copy link
Author

sami616 commented Sep 25, 2019

5.3.0-alpha.2 looks like its on the @next tag it resolved the issue for me

@ndelangen
Copy link
Member

@shilman can we release a patch containing this?

@shilman shilman added the patch:yes Bugfix & documentation PR that need to be picked to main branch label Sep 25, 2019
@SpainTrain
Copy link
Contributor

This issue still exists in 5.3 alpha 6 with @storybook/addon-info. Should this be a separate issue? Thanks!

@jacobrask
Copy link

If anyone gets blocked by this, I can recommend adding skipLibCheck: true to your tsconfig.json - because the internal typings of Storybook don't really matter that much to the type safety of your application code.

shilman added a commit that referenced this issue Oct 7, 2019
add missing type def to addon-knobs fixes #8105
@shilman
Copy link
Member

shilman commented Oct 7, 2019

Yee-haw!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.2 containing PR #8118 that references this issue. Upgrade today to try it out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
addon: knobs bug patch:yes Bugfix & documentation PR that need to be picked to main branch react typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

10 participants