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

Vite: Add react docgen types #21338

Merged
merged 2 commits into from
Mar 6, 2023
Merged

Vite: Add react docgen types #21338

merged 2 commits into from
Mar 6, 2023

Conversation

IanVS
Copy link
Member

@IanVS IanVS commented Mar 1, 2023

Closes #20789

What I did

Adds types for react docgen options to the react-vite framework

How to test

Generate a sandbox for react-vite/default-ts, add an option in the main.ts like:

typescript: {
	reactDocgen: false
}

it should not error.

Checklist

  • Make sure your changes are tested (stories and/or unit, integration, or end-to-end tests)
  • Make sure to add/update documentation regarding your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Maintainers

  • If this PR should be tested against many or all sandboxes,
    make sure to add the ci:merged or ci:daily GH label to it.
  • Make sure this PR contains one of the labels below.

["cleanup", "BREAKING CHANGE", "feature request", "bug", "documentation", "maintenance", "dependencies", "other"]

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @IanVS ! Was in the process of submitting my own PR for this but you beat me to it

/**
* Configures `@joshwooding/vite-plugin-react-docgen-typescript`
*/
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be Parameters<typeof docgenTypescript>[0]? I think parameters returns an array

@kasperpeulen
Copy link
Contributor

Nice!

@IanVS IanVS requested a review from shilman March 6, 2023 13:06
@shilman shilman merged commit 251dd4e into next Mar 6, 2023
@shilman shilman deleted the vite/docgen-types branch March 6, 2023 14:13
D1no added a commit to D1no/reproduction-storybook-symlinks-pnpm that referenced this pull request Mar 6, 2023
@D1no
Copy link

D1no commented Mar 6, 2023

@shilman Since you guys seem to work on this, updated the following ticket reproduction to [email protected]

#21399 [Bug]: No JSDoc generation when story outside root or symlinked (MonoRepo Blocker) ts + vite + [email protected]

https://github.com/D1no/reproduction-storybook-symlinks-pnpm

The same component is included as (1) local copy inside stories/, (2) as reference in .storybook/main.ts and as a (3) symbolic link into stories/.

✅ All three types render successfully in storybook.

❌ Only variant (1) has JSDoc converted to story docs (!)

Exact same component and story, but as you see = different location = no JSDocGen.
storybook_no_jsdocgen

D1no added a commit to D1no/reproduction-storybook-symlinks-pnpm that referenced this pull request Mar 6, 2023
@IanVS
Copy link
Member Author

IanVS commented Mar 6, 2023

@D1no that seems unrelated to this PR. Maybe you're thinking of something else?

D1no added a commit to D1no/reproduction-storybook-symlinks-pnpm that referenced this pull request Mar 6, 2023
@D1no
Copy link

D1no commented Mar 6, 2023

@IanVS Maybe. The work on vite typescript docgen seems to be pretty fragmented. Have no insights 🤷🏻‍♂️ overview. If unrelated, ignore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: reactDocgen types missing from @storybook/react-vite
4 participants