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
The idea is very similar to the //# sourceMappingURL, that JavaScript code file, by self can point to the place where the types declaration related to current source is located. And as the sourceMappingURL the value for the pragma can be a relative path, url, or the inline data url. This will plays well with the individual es modules as well as with the bundles.
📃 Motivating Example
If typescript compiler on one hand will allows to generate the //# typingsURL on on the other will read such pragma from the imported sources this will
Simplify the work with the URI style import as just by the same URL import we will get the production code, and the types declaration.
Helps with the NodeJS 12.7+ package exports as we will not need anymore to put the typings property to the package.json and to exports declaration
💻 Use Cases
For TypeScript to find definition file for imports which targets directly code (not declaration, not package), especially in case when the URL style import will be used.
Such approach can be easy consumed by the IDE (intellisense, documentation), deno, bundlers, ect ...
The text was updated successfully, but these errors were encountered:
The compiler really doesn’t want to parse (or even read) (much less download) JS that it doesn’t need to, which we would have to do in order to read the comment. You’re right that resolving typings for URL imports is something we’ll have to think about. But we’ll figure out the implementation details as part of implementing whole features/scenarios. Thanks for the input!
Suggestion
🔍 Search Terms
typings comment pragma import url
✅ Viability Checklist
My suggestion meets these guidelines:
⭐ Suggestion
Related issues: #35749, #41730, #33079
The idea is very similar to the
//# sourceMappingURL
, that JavaScript code file, by self can point to the place where the types declaration related to current source is located. And as thesourceMappingURL
the value for the pragma can be a relative path, url, or the inline data url. This will plays well with the individual es modules as well as with the bundles.📃 Motivating Example
If typescript compiler on one hand will allows to generate the
//# typingsURL
on on the other will read such pragma from the imported sources this willtypings
property to thepackage.json
and toexports
declaration💻 Use Cases
The text was updated successfully, but these errors were encountered: