storybook icon indicating copy to clipboard operation
storybook copied to clipboard

Deprecation warnings after upgrade to TS 4.8

Open gerhat opened this issue 2 years ago • 3 comments

Describe the bug After upgrading TypeScript to 4.8.2 from 4.7.4 I am getting the following deprecation warnings at the console:

info @storybook/react v6.5.10
info 
info => Loading presets
info => Loading custom manager config
info Addon-docs: using MDX1
info => Using implicit CSS loaders
info => Loading custom manager config
info => Using default Webpack4 setup
12% building 20/23 modules 3 active ...w.js-generated-config-entry.js
info => Using cached manager
70% sealing React Docgen Typescript PluginDeprecationWarning: 'createIdentifier' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: '' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createLiteral' has been deprecated since v4.0.0. Use `factory.createStringLiteral`, `factory.createStringLiteralFromNode`, `factory.createNumericLiteral`, `factory.createBigIntLiteral`, `factory.createTrue`, `factory.createFalse`, or the factory supplied by your transformation context instead.
DeprecationWarning: 'createBinaryExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createPropertyAssignment' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createObjectLiteralExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createExpressionStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createTypeOfExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createElementAccessExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createIfStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createBlock' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createVariableDeclaration' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createCatchClause' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createTryStatement' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createNull' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createFalse' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createTrue' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.
DeprecationWarning: 'createArrayLiteralExpression' has been deprecated since v4.0.0. Use the appropriate method on 'ts.factory' or the 'factory' supplied by your transformation context instead.

To Reproduce Execute:

$ npx sb@next repro

Then select: react, react_typescript, any_folder_name e.g.:

✔ 🌈 Select the repro framework › react
✔ 📝 Select the repro base template › react_typescript
✔ Enter the output directory … TS4.8-deprecations

After it finishes installing everything try:

$ cd TS4.8-deprecations
$ yarn storybook

You should be able to see the warnings towards the top.

System

Environment Info:

  System:
    OS: macOS 12.5.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
  Binaries:
    Node: 14.20.0 - /usr/local/bin/node
    npm: 6.14.17 - /usr/local/bin/npm
  Browsers:
    Chrome: 104.0.5112.101
    Edge: 104.0.1293.70
    Firefox: 104.0
    Safari: 15.6.1
  npmPackages:
    @storybook/addon-actions: ^6.5.10 => 6.5.10 
    @storybook/addon-docs: ^6.5.10 => 6.5.10 
    @storybook/addon-essentials: ^6.5.10 => 6.5.10 
    @storybook/addon-knobs: ^6.4.0 => 6.4.0 
    @storybook/addon-links: ^6.5.10 => 6.5.10 
    @storybook/react: ^6.5.10 => 6.5.10 

gerhat avatar Aug 30 '22 09:08 gerhat

This seems to be an issue with react-docgen-typescript-plugin

lianapache avatar Sep 10 '22 06:09 lianapache

Having the same issue happy to see this issue is known 😄

LinnJS avatar Sep 22 '22 12:09 LinnJS

Hi @shilman

A PR was sent on the dep repo https://github.com/hipstersmoothie/react-docgen-typescript-plugin/pull/70

Any chance to motivate @hipstersmoothie to merge, release and then update storybook/react dep to fix warnings ? 🚀

Moumouls avatar Oct 11 '22 10:10 Moumouls

https://github.com/hipstersmoothie/react-docgen-typescript-plugin/pull/70 has been merged. If anyone has time to bump this to see if it addresses the warnings that would be great!

gravyboat avatar Oct 17 '22 16:10 gravyboat

I can't get rid of the warning. Can I try something?

ghost avatar Nov 05 '22 16:11 ghost

@gravyboat @yogarasu @LinnJS @lianapache @gerhat after updating to latest version (6.5.13) warnings are gone.

Note: i'm using react 18

Moumouls avatar Nov 08 '22 10:11 Moumouls

Nope for me, warnings are still presented is sb 6.5.13. It seems that storybook uses own fork of mentioned plugin

@storybook/react-docgen-typescript-plugin@1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0 in my storybook installation.

It means that someone from storybook core maintainers has to update this dependency according mentioned issue by @gravyboat. Then it will be fixed.

MirKml avatar Nov 08 '22 17:11 MirKml

It seems that @shilman is responsible for plugin fork - https://github.com/storybookjs/react-docgen-typescript-plugin. So @shilman please, can you update @storybook/react-docgen-typescript-plugin to upstream version which includes updates mentioned by @gravyboat which seems fixed this issue?

current stable Typescript is 4.9.2 (4.9 was released before 2 days), but many of us stuck with 4.7.x because of this issue.

MirKml avatar Nov 18 '22 18:11 MirKml

Would be cool to see it this merged!! :)

felixhaeberle avatar Nov 23 '22 11:11 felixhaeberle

I'm getting this issue with TypeScript 4.9.3.

UPDATE: If you're using pnpm (and maybe Yarn?), you can manually fix this with a key like this in your package.json file:

  "pnpm": {
    "overrides": {
      "@storybook/react-docgen-typescript-plugin": "npm:[email protected]"
    }
  }

Note sure why Storybook forked it, or why they aren't keeping it up to date, but that removes the deprecation warnings. 🤷

matthew-dean avatar Nov 26 '22 01:11 matthew-dean

@matthew-dean according the repo, it seems that there are some storybook patches, so I don't know if overriding plugin is save. It's used in doc part of the storybook. When you overrides, all your doc pages are fine?

@onigoetz made the PR https://github.com/storybookjs/react-docgen-typescript-plugin/pull/8, thank you very much. So @shilman can you review, merge this one? For upcoming 6.5.14 which is in progress please.

MirKml avatar Nov 29 '22 17:11 MirKml

I also encountered this issue. It would be nice if it can be fixed in the upcoming 6.5.14 release as @MirKml said.

HyejinYang avatar Dec 01 '22 14:12 HyejinYang

Issue still present in storybook 6.5.14. Looking forward to a fix.

The following is a workaround that worked for me using yarn 3.x:

  1. Add to package.json:
  "resolutions": {
    "@storybook/react-docgen-typescript-plugin": "npm:[email protected]"
  }
  1. Run yarn
  2. Fixed, storybook runs without deprecation warnings from the plugin

bosycom avatar Dec 14 '22 21:12 bosycom

@bosycom's resolution workaround worked for me, for the time being.

marksy avatar Jan 09 '23 02:01 marksy

@bosycom's solution worked for me! Many thanks :)

alb3rtuk avatar Jan 10 '23 15:01 alb3rtuk

Just upgraded to the latest Storybook (6.5.15) and still seeing this.

kaiyoma avatar Jan 10 '23 19:01 kaiyoma

Issue still present in storybook 6.5.14. Looking forward to a fix.

The following is a workaround that worked for me using yarn 3.x:

  1. Add to package.json:
  "resolutions": {
    "@storybook/react-docgen-typescript-plugin": "npm:[email protected]"
  }
  1. Run yarn
  2. Fixed, storybook runs without deprecation warnings from the plugin

Tried the fix but didn't work for 6.5.15

tsmithdk avatar Jan 12 '23 10:01 tsmithdk

Same issue in 7.0.0-beta.20.

DannyJoris avatar Jan 13 '23 15:01 DannyJoris

Issue still present in storybook 6.5.14. Looking forward to a fix.

The following is a workaround that worked for me using yarn 3.x:

  1. Add to package.json:
  "resolutions": {
    "@storybook/react-docgen-typescript-plugin": "npm:[email protected]"
  }
  1. Run yarn
  2. Fixed, storybook runs without deprecation warnings from the plugin

Same warnings with "@nrwl/storybook": "^15.6.2", This didn't work.

supunTE avatar Jan 31 '23 04:01 supunTE

Same issue with 6.5.16 All the above solutions didn't work. Also, storybook is not running with node v18. Only v16.

uditalias avatar Feb 02 '23 10:02 uditalias

Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.48 containing PR #21095 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

shilman avatar Feb 15 '23 11:02 shilman

I see you drop fork completely - 👍. Little bit sad that it's only for sb 7.0+, but it's OK, workaround with package.json overrides works. I will looking forward for 7.0 with typescript 5.0 😉

BTW @uditalias - latest sb 6 works fine with node 18

MirKml avatar Feb 15 '23 20:02 MirKml

still happens in 7.0.0 beta 53

Jack-Works avatar Feb 24 '23 12:02 Jack-Works

Ermahgerd!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.0-beta.61 containing PR #21380 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb@next upgrade --prerelease

shilman avatar Mar 03 '23 16:03 shilman

Using latest typescript 5.0.2 causes issues with storybook-addon-actions, and if I revert to typescript 4.9.5 I get to this issue which is still NOT resolved :(

andrevenancio avatar Mar 17 '23 13:03 andrevenancio

If you add below code to your package.json it will remove the deprecation warnings, yes. But it will make your hot reload 300% slower. I guess deprecation warnings are better in this case.

"resolutions": { "@storybook/react-docgen-typescript-plugin": "npm:[email protected]" }

crunchwrap89 avatar Mar 24 '23 15:03 crunchwrap89