storybook: Pnpm: Missing typescript peer dependency in a Vite/JS project
Running
pnpm create vite@latest
pnpx sb@next init --builder=vite
pnpm run storybook
Yields
WARN Issues with peer dependencies found
.
├─┬ @storybook/addon-essentials 7.0.0-beta.2
│ └─┬ @storybook/addon-controls 7.0.0-beta.2
│ └─┬ @storybook/blocks 7.0.0-beta.2
│ └─┬ @storybook/docs-tools 7.0.0-beta.2
│ └─┬ @storybook/core-common 7.0.0-beta.2
│ └── ✕ missing peer typescript@"*"
└─┬ @storybook/vue3-vite 7.0.0-beta.2
├─┬ @storybook/builder-vite 7.0.0-beta.2
│ └─┬ @joshwooding/vite-plugin-react-docgen-typescript 0.0.5
│ ├── ✕ missing peer typescript@">= 4.3.x"
│ └─┬ react-docgen-typescript 2.2.2
│ └── ✕ missing peer typescript@">= 4.3.x"
└─┬ @storybook/core-server 7.0.0-beta.2
└── ✕ missing peer typescript@"*"
Peer dependencies that should be installed:
typescript@>=4.3.0
_Originally posted by @shilman in https://github.com/storybookjs/storybook/issues/19821#issuecomment-1344053163_
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 29 (24 by maintainers)
I think it would indeed be worth thinking through the overall installation process for storybook. For example, we could ask some questions about whether or not people want docs or tests or typescript, etc. And depending on the answers, we could potentially avoid installing a lot of dependencies. But that’s something to think about after 7.0 is released. 😅
@ermik I wish there was a way to determine:
But that’s as @IanVS also explains… configurable… we’ll only know we need it at runtime, and therefore we must have a dependency on it.
I think the challenge is that storybook wants to support TypeScript “out of the box”, without requiring users to install something else for it to work. This means that it has to include packages like this.
Looks like we need to add
@babel/core@"*"to@storybook/preset-preact-webpackDo a similar change to make
fork-ts-checker-webpack-pluginhave a optional dependency ontypescript.ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.14 containing PR #20359 that references this issue. Upgrade today to the
@nextNPM tag to try it out!Closing this issue. Please re-open if you think there’s still more to do.
@robin-thomas if this is causing you issues, you should be able to use an override to control the version of
@joshwooding/vite-plugin-react-docgen-typescriptin your package.json, until this is released. Betas are normally released every few days, but with the holidays it might take a bit longer.@robin-thomas you’re right, I’ll open a PR today that should fix that. All that should be required is upgrade storybook to the latest release of
@joshwooding/vite-plugin-react-docgen-typescript.