Skip to content

Conversation

@orta
Copy link
Contributor

@orta orta commented Sep 24, 2021

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.

@orta orta self-assigned this Sep 24, 2021
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Sep 24, 2021
@orta orta requested a review from andrewbranch September 24, 2021 16:17
@andrewbranch
Copy link
Member

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.

@andrewbranch
Copy link
Member

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.

@orta
Copy link
Contributor Author

orta commented Sep 24, 2021

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.

@orta orta merged commit 90e83ad into microsoft:main Sep 24, 2021
@andrewbranch
Copy link
Member

Ah, I forgot about that 👍

uhyo added a commit to uhyo/better-typescript-lib that referenced this pull request Sep 25, 2021
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: Team For Milestone Bug PRs that fix a bug with a specific milestone

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ensure @typescript/[lib] package names are explicitly prefixed with lib

3 participants