GeezerVison is showing github.com — Resolve with -lib in TypeScript lib lookup via node-style resolution by orta · Pull Request #46046 · microsoft/TypeScript
Conversation
Fixes #45993
#45771 introduced a way to write something like:
{
"dependencies": {
"@typescript/dom": "npm:@types/web"
}
}
This PR changes that to be:
{
"dependencies": {
"@typescript/lib-dom": "npm:@types/web"
}
}
Thus the node-style resolution for:
lib.dom.d.ts -> @typescript/lib-dom
lib.dom.iterable.d.ts -> @typescript/lib-dom/iterable
lib.es2015.symbol.wellknown.d.ts -> @typescript/lib-es2015/symbol-wellknown
If you made a package which just sets up @typescript/lib-es2015/symbol-wellknown.d.ts without @typescript/lib-es2015/index.d.ts, then es2015 would still resolve to the TypeScript hosted version.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
DanielRosenwasser and ExE-Boss reacted with thumbs up emoji
|
This looks good, though it does make me consider, why do any transform on the lib file name at all? Package names can have dots, so there’s no reason our lookup name can’t be @typescript/lib.dom.d.ts, and then we wouldn’t have to do any of the name parsing.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Maybe leaving on the .d.ts would look confusing to some people (though it’s not actually ambiguous), but I’d be tempted to at least leave the dots instead of dashes. I don’t guess it really matters, though.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I think it's more about the form factor for how I think people would use it - for dom that means we can ship dom and dom.iterable correctly in a single package, instead of via 2 separate npm packages
The same would then apply for 'my runtime's version of es2018' which you can opt-in specific files.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Ah, I forgot about that 👍
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.