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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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