You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Many types in @headlessui/react are not exported.
This cause those "using private name" or "type X from module Y but cannot be named" TypeScript error very easily.
I believe that any type the is part of the public API should be exported.
If you concern the number of types exported can be overwhelming,
one way to manage them is by using namespace. For example:
Another example is when using storybook (I didn't add that to the repro, but this is straight forward):
// listbox.stories.tsximport{Listbox}from'@headlessui/react'exportdefault{// Default export of the module has or is using private name 'ComponentListbox'.component: Listbox}
The text was updated successfully, but these errors were encountered:
@RobinMalfait any idea why these errors don't show up in the react playground? It should basically be set up in a similar way so I would have expected them to. They definitely pop up in the provided reproduction.
Hey, we've merged #2313 which gets rid of this error. We still consider the interfaces themselves to be "internal" in a sense because we may end up changing the implementation should we come up with a nicer solution than the interfaces. Because of this we've prefixed them all with _internal_ but you shouldn't ever have to import the interfaces explicitly in your code so this shouldn't be a big issue.
It'll be available in the next release but in the meantime you can test this out using our insiders build:
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
v1.7.12
What browser are you using?
N/A (TypeScript issue)
Reproduction URL
Describe your issue
Many types in
@headlessui/react
are not exported.This cause those "using private name" or "type X from module Y but cannot be named" TypeScript error very easily.
I believe that any type the is part of the public API should be exported.
If you concern the number of types exported can be overwhelming,
one way to manage them is by using
namespace
. For example:Another example is when using storybook (I didn't add that to the repro, but this is straight forward):
The text was updated successfully, but these errors were encountered: