Uh oh!
There was an error while loading. Please reload this page.
Add new option "libReplacement" - #60829
Conversation
jakebailey
commented
Dec 19, 2024
@typescript-bot test it |
typescript-bot
commented
Dec 19, 2024
Looks like you're introducing a change to the public API surface area. If this includes breaking changes, please document them on our wiki's API Breaking Changes page. Also, please make sure @DanielRosenwasser and @RyanCavanaugh are aware of the changes, just as a heads up. |
typescript-bot
commented
Dec 20, 2024
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
typescript-bot
commented
Dec 20, 2024
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
typescript-bot
commented
Dec 20, 2024
@jakebailey Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
typescript-bot
commented
Dec 20, 2024
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
jakebailey
commented
Jan 8, 2025
I guess nobody in our extended test suite uses this feature, or at least, their use of it does not actually "help" anything. Which all is a good thing. |
I am tentatively marking this as ready for review; it doesn't really seem like anyone is using lib replacement at all in our extended suite, and this is IMO a good optimization which avoids setting up a load of failed resolution watchers. But, maybe this just needs to wait for 6.0. The only thing this PR is probably missing are unit tests / some verification of the options I set on it, which I believe are probably wrong (should be more than |
bd74a31 to
a81cb69Comparejakebailey
commented
Jan 10, 2025
@typescript-bot perf test tsserver-only |
jakebailey
commented
Jan 10, 2025
Consensus in the design meeting was to default this to "true" (do lib replacement) until 6.0 where we default it to "false" (don't do lib replacement). Also, name can be bikeshedded. |
typescript-bot
commented
Jan 10, 2025
@jakebailey Here they are:tsserverComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| @@ -0,0 +1 @@ | |||
| [] No newline at end of file | |||
There was a problem hiding this comment.
Compare to tests/baselines/reference/libReplacement(libreplacement=true).trace.json below, which has 1003 lines of traces for an empty file with lib=esnext.
There was a problem hiding this comment.
Now 1,016 after we added more lib.d.ts files 😄
jakebailey
commented
Jan 13, 2025
@typescript-bot test it |
typescript-bot
commented
Jan 13, 2025
Hey @jakebailey, the results of running the DT tests are ready. Everything looks the same! |
typescript-bot
commented
Jan 13, 2025
@jakebailey Here are the results of running the user tests with tsc comparing Everything looks good! |
typescript-bot
commented
Jan 13, 2025
@jakebailey Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
typescript-bot
commented
Jan 13, 2025
@jakebailey Here are the results of running the top 400 repos with tsc comparing Everything looks good! |
bd59e00 to
c792dbaComparejakebailey
commented
Jan 22, 2025
The only other thing I'm looking for is a bikeshed on the name; there are tests in the repo that call this "lib redirection", which is making me question this name. |
| `, | ||
| "/home/src/workspace/projects/project1/tsconfig.json": jsonToReadableText({ | ||
| compilerOptions: { composite: true, typeRoots: ["./typeroot1"], lib: ["es5", "dom"], traceResolution: true }, | ||
| compilerOptions: { composite: true, typeRoots: ["./typeroot1"], lib: ["es5", "dom"], traceResolution: true, libReplacement: libRedirection }, |
There was a problem hiding this comment.
Note libRedirection here.....
jakebailey
commented
Jan 22, 2025
The PR which added this, #45771, uses the term "override"... |
Lib replacement (https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#supporting-lib-from-node_modules) allows specially-named packages in
node_modulesto replace TypeScript's bundledlib.d.tsfiles. This feature is always on, so we always perform resolution to look for it in case it exists. This can have a negative perf impact; it's extra watchers, extra CPU time, extra IO, etc.This PR adds a new compiler option
libReplacementto control the feature; by default, it's enabled. In TS 6.0, it will be disabled by default.