In TypeScript 5.8, we introduced the libReplacement. This flag toggled whether or not TypeScript actually looked for libraries via node_modules/@typescript/lib-*
For example, if you have "lib": ["es2015", "dom"] in your settings, TypeScript would try to resolve @typescript/lib-es2015 and @typescript/lib-dom from node_modules and load their contents. However, this resolution happened regardless of whether you were using the functionality, and libReplacement lets you opt out.
In TypeScript 7.0 (the native preview), we've ported libReplacement to be false by default.
TypeScript 6.0 will change the default to false to align with TypeScript 7.0
See more similar discussions around 6.0/7.0 changes at #54500.
In TypeScript 5.8, we introduced the
libReplacement. This flag toggled whether or not TypeScript actually looked for libraries vianode_modules/@typescript/lib-*For example, if you have
"lib": ["es2015", "dom"]in your settings, TypeScript would try to resolve@typescript/lib-es2015and@typescript/lib-domfromnode_modulesand load their contents. However, this resolution happened regardless of whether you were using the functionality, andlibReplacementlets you opt out.In TypeScript 7.0 (the native preview), we've ported
libReplacementto befalseby default.TypeScript 6.0 will change the default to
falseto align with TypeScript 7.0See more similar discussions around 6.0/7.0 changes at #54500.