storybook
storybook copied to clipboard
[Feature Request]: Investigate Typescript 5.0
Is your feature request related to a problem? Please describe
Typescript 5.0 release is around the corner (March 14th), and the 5.0 RC is available on February 28th. We should make sure that Storybook works with Typescript 5.0.
Describe the solution you'd like
We should set up an internal sandbox that runs Typescript 5.0 prerelease version to avoid unpleasant surprises on the release date.
Questions:
- Should prerelease sandboxes (Typescript RC, Angular 16 RC,...) block PRs from being mergeable as soon as they fail? @shilman
- Should we report failures of prerelease sandboxes in our Discord monitoring channel? @shilman
- What is the cadence and procedure of fixing prerelease sandboxes and turning them green again when they fail? @vanessayuenn
Describe alternatives you've considered
No response
Are you able to assist to bring the feature to reality?
yes, I can
Additional context
No response
Should prerelease sandboxes (Typescript RC, Angular 16 RC,...) block PRs from being mergeable as soon as they fail? Should we report failures of prerelease sandboxes in our Discord monitoring channel?
Probably yes to both. By the time a dependency reaches RC, we probably want to make sure it's green all the way up until the release. We can adjust this if it becomes too noisy.
Prior to RC, we should probably either remove that test from our CI, or treat it like a community framework, where we want to know when it fails, but we shouldn't block anything when it fails.
Is TS 5.0 support intended to only be available in storybook@7?
@wegry Currently, yes. Only critical security fixes are patched back to 6.5.
It does not mean, though, that SB 6.5 does not work with TS 5.0. We just don't guarantee it.
Just upgraded to TS 5.0.2, and storybook fails on startup in the @storybook/react-docgen-typescript-plugin
which in @storybook/[email protected]
seems to be pinned at 1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0
so unable to upgrade that to latest canary to see if that would resolve the issue.
Error:
TypeError: typescript_1.default.createIdentifier is not a function
at setDisplayName (/packages/web/node_modules/@storybook/react/node_modules/@storybook/react-docgen-typescript-plugin/dist/generateDocgenCodeBlock.js:37:186)
at /packages/web/node_modules/@storybook/react/node_modules/@storybook/react-docgen-typescript-plugin/dist/generateDocgenCodeBlock.js:201:34
@pachuka I'm also seeing that with storybook 6.5.16 & ts 5.0.2
On the plus side, it works ok for me with storybook 7.0.0-rc.3 & ts 5.0.2
Yep I figured it would be fine with storybook 7, but I'd like to upgrade to that after RC/beta is complete, just wanted to point out that if folks wanted it working on 6.5.x probably need a patch for it.
@vanessayuenn I think there's nothing to do here before GA.
I chatted with @valentinpalkovic and identified though there are some possible incompatibilities, users have a few options:
- Not use the new syntax features in code bundled/transpiled by storybook. This isn't as hard as it seems, considering the new language feature aren't super common place yet., and aren't likely to be unless the renderer/framework relies heavily on classes.
- The new language features CAN be used if the right version of the right packages are used. The user could ensure these versions are used via lockfiles or resolutions.
This isn't blocking GA IMHO.
@ndelangen thanks for the investigation! Good to know this isn't GA-blocking, but is there anything else to be done post-GA? For now, we can update the documentation with the potential incompatibilities you mentioned.
Long term, we'll want to:
- Upgrade storybook's monorepo to TypeScript 5 (this is a maintenance task)
- Ensure storybook is compatible with 5.0.0 and the generators we're compatible with (this will sort of happen automatically because generators will publish new versions and we'll start using them after ~24h)
- Maybe add an internal sandbox to test compatibility with TypeScript 5, but I'm not sure there's a need for this.
- Maybe investigate if the new language features might be useful for storybook or it's users.
closing with followup tasks in #21792