-
Notifications
You must be signed in to change notification settings - Fork 54
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 support for package exports #367
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Current support for
@types
packages is to just load the base packages into the project. The existing logic handles any dependency types, but is unable to handle types specified by package exports ("exports" field on thepackage.json
).For example, having the following
package.json
won't produce types for
because only the base
@types/react-dom
package'sindex.d.ts
is loaded.It is not able to resolve the
./client
part from the package exports here: https://unpkg.com/@types/react-dom@18.2.4/package.jsonIn this particular case, a work around was available to add
@types/react-dom/client
as because they thankfully had a file calledclient.d.ts
that the type resolver ended up adding to the project, and along with thepackage.json
file from@types/react-dom
, TS was able to resolve this.Not sure exactly on best approach to support this.. A naive approach is to crawl the "exports" field of package.json and eagerly load all listed types. Or a smarter approach that handles the extra paths.
The text was updated successfully, but these errors were encountered: