Skip to content

Conversation

@orta
Copy link
Contributor

@orta orta commented Aug 19, 2021

Fixes #44795

This PR changes the lib file resolving based on whether you have included an override in your tsconfig.json, so for example:

{
  "compilerOptions": {
    "target": "es2015",
    "lib": ["es2015", { replace: "dom", with: "@types/web" }]
  }
}

Would never access lib.dom.d.ts if it were imported via a /// <reference lib="dom" /> - it would redirect to @types/web resolved relative to the tsconfig.json which is how it would be referred to by DT modules and libraries.


PR TODO

  • Resolve the with to a real file path during tsconfig creation, so that it can be used later before the checker starts up (and by which point we've lost the reference to the tsconfig filepath)
  • Add some error handling
  • Cleanup all the 'do not ship with theses
  • Add a getLib helper which returns string[]
  • Test with symlinks (e.g. replace dom where the file is a symlink, and where the dir where the file lives is a symlink)

@orta
Copy link
Contributor Author

orta commented Sep 8, 2021

This is likely to not ship in favor of #45771

@orta orta closed this in #45771 Sep 15, 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 Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support having '@types/web' as overriding 'dom' in TypeScript's lib resolver

2 participants