Skip to content

Types inlined (duplicated) in declarations in the generated declaration file #56969

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

Closed
1 task done
bugron opened this issue Jan 6, 2024 · 2 comments
Closed
1 task done

Comments

@bugron
Copy link

bugron commented Jan 6, 2024

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Hi there,
I'm working on a component library and there is a type generation behavior I don't quite understand.

Here is an example. Notice that ButtonProps in the .D.TS tab is inlined (duplicated) in the Button declaration.

I have another component that uses a type union in its prop types and I don't see the prop types being inlined in the component declaration there. So I tried this - no type inlining 🤷‍♂️

Also using an interface here seems to fix this issue too.

Could you please help me understand why the type inlining happened in the first example and how to avoid it without the weird T | T or using an interface?

Thanks in advance for any help 🙏

@robpalme
Copy link

robpalme commented Jan 6, 2024

Duplication of types in emitted DTS files is a well-known existing issue.

For projects that opt-in, it will be solved by Isolated Declarations.

@bugron
Copy link
Author

bugron commented Jan 8, 2024

Got it. Thanks @robpalme!

@bugron bugron closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 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

2 participants