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

Types from external dependencies #134

Open
flugg opened this issue May 23, 2024 · 2 comments
Open

Types from external dependencies #134

flugg opened this issue May 23, 2024 · 2 comments

Comments

@flugg
Copy link

flugg commented May 23, 2024

Hi! First of all, really great project!

I got things running using the ExportedTypes component like this:

<ExportedTypes source="./src/button.tsx" workingDirectory="../../packages/components/button" />

However, the output only includes local types defined in the button.tsx file and not any types that's extended. The button file looks like this:

import type { ReactNode, RefObject } from 'react';
import type { ButtonProps as ReactAriaButtonProps } from 'react-aria-components';

export interface ButtonProps extends ReactAriaButtonProps {
  children?: ReactNode;
  isLoading?: boolean;
  ref?: RefObject<HTMLButtonElement>;
}

And I would like to get access to all props including those from within the React Aria Components library. How would I do it?

Thanks!

@souporserious
Copy link
Owner

Hey, thank you!

Hm, I think this is an issue with node_modules specifically since currently any types outside of the project are skipped over. There could be an additional option to process them though so something like <ExportTypes includeNodeModules /> or maybe a filterType prop might be better.

@flugg
Copy link
Author

flugg commented May 26, 2024

An option to delicately pick which props to include sounds very reasonable to me, and is similar to how react-docgen-typescript does it with the propFilter prop. I've previously utilized this prop in my Storybook configuration to include metadata for props from node_modules for my controls.

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

2 participants