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
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 the package.json).
For example, having the following package.json
{
"dependencies": {
"@types/react-dom": "^18"
}
}
won't produce types for
import{createRoot}from'react-dom/client';
because only the base @types/react-dom package's index.d.ts is loaded.
In this particular case, a work around was available to add @types/react-dom/client as because they thankfully had a file called client.d.ts that the type resolver ended up adding to the project, and along with the package.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:
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/[email protected]/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: