Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: declarations and parent objects for props are not populated with TypeScript >= v5.1.3 #483

Open
Francois-Esquire opened this issue Jul 14, 2023 · 3 comments

Comments

@Francois-Esquire
Copy link

The declarations and parent properties on the docgen property object appear to be missing (thus not filtered by the default method) in later versions of typescript (after v5.0.4). For example, a docgen property object when working as expected:

{
  defaultValue: null,
  description: '',
  name: 'key',
  parent: {
    fileName: '<root>/node_modules/@types/react/index.d.ts',
    name: 'Attributes'
  },
  declarations: [
    {
      fileName: '<root>/node_modules/@types/react/index.d.ts',
      name: 'Attributes'
    }
  ],
  required: false,
  type: { name: 'Key | null | undefined' }
}

compared to:

{
  defaultValue: null,
  description: '',
  name: 'key',
  parent: undefined,
  declarations: [],
  required: false,
  type: { name: 'Key | null | undefined' }
}

After some exploration, (this part of the source code) where the declarations are populated for each property do not seem to be working after v5.1.3. The thread appears to lead to typescript itself (ts.Symbol) has changed.

See previous issue.

@genepaul
Copy link

I just want to add that I'm seeing this situation in a project on TypeScript 4.9.5, so I don't know if this is necessarily related to TypeScript version (at least not the major version update). In my investigations, I came to believe that this might be related to the tsconfig that is used when running the parser - perhaps which types are considered to be "in the program" will affect whether those types are correctly populated? I'm stabbing in the dark here because my knowledge of the TS compiler is limited.

Copy link

There was no activity for a long time. The issue will be closed soon.

@github-actions github-actions bot added the stale There is no activity for a long time. label Jul 21, 2024
@SFilinsky
Copy link

@Francois-Esquire did you solve that?

Having similar issue to Garden components - I'm doing custom library and what to do Storybook for components, importing them as dependency from package (import ... from 'my-library-name'). It doesn't display any properties from these components, but it fixes if I import them directly by path, without package name (import .... from '../../my-library/src/components/').

@github-actions github-actions bot removed the stale There is no activity for a long time. label Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants