Closed as not planned
Description
It's annoying to have to specify stuff like // @deno-types="..." />
above an import (ex. for a npm:@types/...
package) and sometimes it's not possible to specify it (ex. with jsxImportSource
: denoland/deno#18203).
Perhaps for any import map entry, deno_graph
should try to resolve a corresponding @types/<entry-name>
when resolving the types of a module. For example:
Then when a user imports react
or react/jsx-server
this would get the corresponding types.
This would also not be npm specific and allow for mapping to non-npm types like:
{
"imports": {
"react": "npm:react@18",
"react/": "npm:/react@18/",
"@types/react": "./@types/react@18/mod.d.ts",
"@types/react/": "./@types/react@18/",
}
}
Import map unfurling
This introduces some complexities when unfurling import maps, but I don't believe it would be too bad because we could inject a // @deno-types="..."
comment above the import/export.
Metadata
Metadata
Assignees
Labels
No labels