Storybook: SB 5.2 Typescript build fail - (Addon-knobs)

Created on 17 Sep 2019  路  15Comments  路  Source: storybookjs/storybook

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'.
knobs react bug patch typescript

Most helpful comment

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

All 15 comments

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

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

They can delete the dep on those types now.

ah, makes sense. 馃憤

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?

@types/storybook__react is now also not needed?

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

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.

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!

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

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!

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

@shilman can we release a patch containing this?

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

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.

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!

Was this page helpful?
0 / 5 - 0 ratings