hipstersmoothie / react-docgen-typescript-plugin

A webpack plugin to inject react typescript docgen information
MIT License
68 stars 28 forks source link

Issues on typescript 5.0.2 #83

Open andrevenancio opened 1 year ago

andrevenancio commented 1 year ago

So using Storybook, and their default addon-actions@6.5.16 alongside typescript@5.0.2 When I build npm run storybook I get errors on this plugin

70% sealing plugins DocGenPlugin/USER_PATH_OMMITED_FOR_PRIVACY/node_modules/@storybook/react-docgen-typescript-plugin/dist/generateDocgenCodeBlock.js:37
    return insertTsIgnoreBeforeStatement(typescript_1.default.createExpressionStatement(typescript_1.default.createBinary(typescript_1.default.createPropertyAccess(typescript_1.default.createIdentifier(d.displayName), typescript_1.default.createIdentifier("displayName")), typescript_1.default.SyntaxKind.EqualsToken, typescript_1.default.createLiteral(d.displayName))));
                                                                                                                                                                                         ^

TypeError: typescript_1.default.createIdentifier is not a function

I've tried using resolutions on my package.json but to no avail

  "resolutions": {
    "@storybook/react-docgen-typescript-plugin": "npm:react-docgen-typescript-plugin@1.0.5"
  },
titouan42 commented 1 year ago

I had the same problem, but waiting for the bug to be fixed, I updated my .storybook/main.js configuration as follows:

module.exports = {
  addons: [
    {
      name: '@storybook/addon-essentials',
      options: {
        actions: true,
        backgrounds: true,
        controls: false,
        docs: false,
        viewport: true,
        toolbars: true,
      },
    },
  ],
};
claudiowilson commented 1 year ago

having the same issue

lukeapage commented 1 year ago

https://github.com/microsoft/TypeScript/wiki/API-Breaking-Changes

image

lukeapage commented 1 year ago

I think the issues are fixed: https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commit/b6b5d0615e666bee3c931b3e1c1d5b490257fcea

The trouble that story book hasn't updated either in the latest v6 or v7

https://github.com/storybookjs/storybook/blob/main/app/react/package.json#L59

See:

https://github.com/storybookjs/storybook/issues/21642 https://github.com/storybookjs/storybook/issues/21276 https://github.com/hipstersmoothie/react-docgen-typescript-plugin/issues/78#issuecomment-1409224863

hipstersmoothie commented 1 year ago

@shilman Maybe you could upstream the changes we've made? or switch back to this? lots of people having issues

shilman commented 1 year ago

@hipstersmoothie We've updated in Storybook 7. I've also fixed some issues in the library on our branch and would love to contribute them back. I'll put together a PR today.

We should probably update 6.5 also but have been focused on getting 7 out

shilman commented 1 year ago

@hipstersmoothie I've patched it back to 6.5.x in a prerelease but more issues are coming in, so looking at that on our fork. Will create a PR when the dust is settled.

chortis commented 1 year ago

@hipstersmoothie I've patched it back to 6.5.x in a prerelease but more issues are coming in, so looking at that on our fork. Will create a PR when the dust is settled.

Hey thanks for doing this. Is there any update on when this moves out of pre-release? We can't support 7 yet as we're still on Webpack 4 :(

Cheers

hipstersmoothie commented 1 year ago

This shouldn't be in prerelease. all updates to this package have been released

rafaelrozon commented 10 months ago

Any updates on this? I'm also getting the same error.