storybook icon indicating copy to clipboard operation
storybook copied to clipboard

[Feature Request]: Investigate Typescript 5.0

Open valentinpalkovic opened this issue 1 year ago • 6 comments

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:

  1. Should prerelease sandboxes (Typescript RC, Angular 16 RC,...) block PRs from being mergeable as soon as they fail? @shilman
  2. Should we report failures of prerelease sandboxes in our Discord monitoring channel? @shilman
  3. 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

valentinpalkovic avatar Feb 27 '23 14:02 valentinpalkovic

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.

shilman avatar Feb 28 '23 00:02 shilman

Is TS 5.0 support intended to only be available in storybook@7?

wegry avatar Mar 13 '23 13:03 wegry

@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.

valentinpalkovic avatar Mar 16 '23 12:03 valentinpalkovic

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 avatar Mar 16 '23 21:03 pachuka

@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

jdelStrother avatar Mar 16 '23 21:03 jdelStrother

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.

pachuka avatar Mar 17 '23 02:03 pachuka

@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 avatar Mar 27 '23 08:03 ndelangen

@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.

vanessayuenn avatar Mar 28 '23 06:03 vanessayuenn

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.

ndelangen avatar Mar 28 '23 07:03 ndelangen

closing with followup tasks in #21792

shilman avatar Mar 28 '23 09:03 shilman