question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Adding @storybook/react breaks our app's compilation

See original GitHub issue

Describe the bug Just doing yarn add @storybook/react -D breaks our app’s compilation (TypeScript). That’s the only step. I’m not even trying to run Storybook yet.

To Reproduce Very hard to reproduce. We have a somewhat big TypeScript app, tons of packages and configurations.

Code snippets

  1. package.json: https://gist.github.com/kg-currenxie/1aa3c2c0829b0a787bd97c95011a7c9d
  "devDependencies": {
+    "@storybook/react": "^5.1.8",
  1. Full yarn.lock diff file. This is probably the error? It might mess with all of our babel versions? http://www.mergely.com/Sy0nNgsH/

  2. webpack config https://gist.github.com/kg-currenxie/e7edb5f1352ef9d6c6ce76d33008cdb6

  3. tsconfig https://gist.github.com/kg-currenxie/62cc2389c23748253e3baf5087c82706

System:

  • @babel/core”: “7.4.5”
  • @storybook/react”: “^5.1.8”
  • “typescript”: “3.2.1”
  • “webpack”: “4.32.2”
  • “react”: “^16.8.6”

Additional context The compilation error it self is some crazy type errors (in multiple places in our app).

Things like this. Worked fine before we did yarn add @storybook/react -D 🤷‍♂

Type '{ children: (count: number) => Element; ids: any; }' is not assignable to type '(IntrinsicAttributes & IntrinsicClassAttributes<Component<(Pick<{}, never> & IStatusContainerOwnProps) | (Pick<Pick<{}, never> & IStatusContainerOwnProps, "children" | "component" | "ids" | "hideZero"> & Pick<...>) | (Pick<...> & ... 1 more ... & Partial<...>) | (Pick<...> & ... 1 more ... & Partial<...>), any, any>...'.
  Type '{ children: (count: number) => Element; ids: any; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<(Pick<{}, never> & IStatusContainerOwnProps) | (Pick<Pick<{}, never> & IStatusContainerOwnProps, "children" | "component" | "ids" | "hideZero"> & Pick<...>) | (Pick<...> & ... 1 more ... & Partial<...>) | (Pick<...> & ... 1 more ... & Partial<...>), any, any>>...'.
    Property 'hideZero' is missing in type '{ children: (count: number) => Element; ids: any; }' but required in type 'Readonly<Pick<Pick<{}, never> & IStatusContainerOwnProps, "children" | "component" | "ids" | "hideZero"> & Partial<Pick<Pick<{}, never> & IStatusContainerOwnProps, never>> & Partial<...>>'.  TS2322

Hint: In this case, hideZero is defined as static defaultProps..., but suddenly isn’t working. But default props should work since typescript 3.0.

Although, we have other errors not related to defaultProps.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ythecombinatorcommented, Jul 24, 2019

@kg-currenxie, I spent a few hours updating dependency by dependency and, apparently, updating react and react-dom did the thing – but I am not quite sure yet. So:

  1. Thanks for your priceless tip (I probably would have taken a few more hours to guess that)
  2. WTF! This works but still puzzles me in a way I cannot even say
1reaction
ythecombinatorcommented, Jul 23, 2019

@kg-currenxie did you manage to figure it out?

This thing is puzzling me for hours and this issue is the closest thing I could find.

The only difference is I don’t get the same error by just deleting the yarn.lock and installing again – actually, I can install almost any dependency I can think of; only storybook itself and its addons break the build.

For reference, by simply adding any of the listed below I get the whole thing crashed:

Screen Shot 2019-07-24 at 00 02 32
Read more comments on GitHub >

github_iconTop Results From Across the Web

Configure Storybook
Configure story loading ... By default, Storybook will load stories from your project based on a glob (pattern matching string) in .storybook/main.js that...
Read more >
Storybook React: A Beginner's Tutorial to UI Components
Simplifies component building: Storybook creates “stories” or small components that run independently and that you can then add to your ...
Read more >
Creating a React component library using Storybook 6
Setting up the project · Installing Storybook · Adding stories and setting up the file structure · Compiling the Library using Rollup ·...
Read more >
Creating a React Component Library using Rollup, Typescript ...
It''ll also cover how you can build your own React component library! ... Adding TypeScript; Adding Rollup; Adding Storybook; Adding Jest ...
Read more >
Tailwind css classes not showing in Storybook build
I specify the necessary plugins in a postcss.config.js (in my project ... in .storybook/preview.js file add this line to compile tailwind ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found