Skip to content

Remove no-default-lib - #62435

Merged
Jake Bailey (jakebailey) merged 8 commits into
microsoft:mainfrom
jakebailey:fix-62209
Sep 24, 2025
Merged

Remove no-default-lib#62435
Jake Bailey (jakebailey) merged 8 commits into
microsoft:mainfrom
jakebailey:fix-62209

Conversation

@jakebailey

@jakebaileyJake Bailey (jakebailey) commented Sep 11, 2025

Copy link
Copy Markdown
Member

Fixes#62209

@typescript-bot

Copy link
Copy Markdown
Contributor

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 Daniel Rosenwasser (@DanielRosenwasser) and Ryan Cavanaugh (@RyanCavanaugh) are aware of the changes, just as a heads up.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) test it

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR removes the no-default-lib TypeScript compiler directive feature. The change ensures that default TypeScript libraries are always included in compilation unless explicitly excluded through compiler options, eliminating a source of confusion where individual files could opt out of standard library inclusion.

  • Removes processing and handling of the no-default-lib directive
  • Updates test baselines to reflect that default libraries are now always included
  • Marks the hasNoDefaultLib property as deprecated in the public API

Reviewed Changes

Copilot reviewed 59 out of 62 changed files in this pull request and generated no comments.

Show a summary per file
FileDescription
tests/baselines/reference/tsxResolveExternalModuleExportsTypes.typesUpdates performance stats to reflect increased type counts from including libraries
tests/baselines/reference/tsserver/configuredProjects/should-not-close-configured-project-after-closing-last-open-file,-but-should-be-closed-on-next-file-open-if-its-not-the-file-from-same-project.jsAdds default library information in project output
tests/baselines/reference/tscWatch/programUpdates/when-skipLibCheck-and-skipDefaultLibCheck-changes.jsRemoves library-related errors that no longer occur
tests/baselines/reference/tscWatch/libraryResolution/*.jsUpdates library resolution order and removes duplicate lib entries
tests/baselines/reference/tsc/libraryResolution/*.jsUpdates shape signatures order for library files
tests/baselines/reference/tsc/incremental/ts-file-with-no-default-lib-that-augments-the-global-scope.jsAdds additional library files and errors from forced inclusion
tests/baselines/reference/project/noDefaultLib/*.jsonAdds default library files to resolved inputs
tests/baselines/reference/noDefaultLib.*Shows library symbols now merged with user-defined interfaces
tests/baselines/reference/api/typescript.d.tsMarks hasNoDefaultLib and isLibFile properties as deprecated
tests/baselines/reference/declarationEmitPreservesHasNoDefaultLibDirective.Removes the no-default-lib directive from emitted declarations

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 11, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
test top400✅ Started✅ Results
user test this✅ Started✅ Results
run dt✅ Started👀 Results
perf test this faster✅ Started👀 Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: miniprogram-wxs
Error:

Error: /mnt/vss/_work/1/DefinitelyTyped/types/miniprogram-wxs/miniprogram-wxs-tests.ts
7:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
10:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
✖ 2 problems (2 errors, 0 warnings)
at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250911/node_modules/@definitelytyped/dtslint/dist/index.js:199:28)
at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250911/node_modules/@definitelytyped/dtslint/dist/index.js:191:20)

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/62435/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@jakebailey
Jake Bailey (jakebailey) marked this pull request as draft September 11, 2025 17:15
@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-Unions - node (v18.15.0, x64)
Errors3434~~~p=1.000 n=6
Symbols62,37062,370~~~p=1.000 n=6
Types50,38650,386~~~p=1.000 n=6
Memory used195,223k (± 0.96%)193,999k (± 0.96%)~192,746k196,421kp=0.173 n=6
Parse Time1.30s (± 0.58%)1.30s (± 0.58%)~1.29s1.31sp=1.000 n=6
Bind Time0.72s0.72s~~~p=1.000 n=6
Check Time9.73s (± 0.20%)9.74s (± 0.38%)~9.71s9.80sp=1.000 n=6
Emit Time2.74s (± 0.68%)2.74s (± 0.54%)~2.72s2.76sp=0.808 n=6
Total Time14.50s (± 0.25%)14.51s (± 0.24%)~14.47s14.57sp=0.808 n=6
angular-1 - node (v18.15.0, x64)
Errors11~~~p=1.000 n=6
Symbols948,914948,914~~~p=1.000 n=6
Types410,884410,884~~~p=1.000 n=6
Memory used1,245,603k (± 0.01%)1,245,614k (± 0.00%)~1,245,583k1,245,627kp=0.689 n=6
Parse Time6.53s (± 0.77%)6.51s (± 0.32%)~6.49s6.55sp=1.000 n=6
Bind Time1.87s (± 0.28%)1.87s (± 0.59%)~1.85s1.88sp=0.784 n=6
Check Time32.16s (± 0.40%)32.15s (± 0.35%)~32.01s32.32sp=0.748 n=6
Emit Time14.79s (± 0.43%)14.87s (± 0.56%)~14.81s15.04sp=0.107 n=6
Total Time55.36s (± 0.30%)55.40s (± 0.36%)~55.23s55.75sp=1.000 n=6
mui-docs - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols2,542,2332,542,233~~~p=1.000 n=6
Types902,605902,605~~~p=1.000 n=6
Memory used2,827,015k (± 0.00%)2,826,967k (± 0.00%)~2,826,924k2,827,029kp=0.810 n=6
Parse Time10.49s (± 0.62%)10.53s (± 0.69%)~10.42s10.65sp=0.325 n=6
Bind Time2.63s (± 0.70%)2.63s (± 0.52%)~2.60s2.64sp=0.743 n=6
Check Time103.59s (± 1.16%)105.38s (± 3.12%)~102.26s109.61sp=0.471 n=6
Emit Time0.38s (± 2.88%)0.38s (± 2.17%)~0.36s0.38sp=1.000 n=6
Total Time117.09s (± 1.02%)118.92s (± 2.81%)~115.66s123.17sp=0.471 n=6
self-build-src - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,237,0191,237,032+13 (+ 0.00%)~~p=0.001 n=6
Types259,717259,718+1 (+ 0.00%)~~p=0.001 n=6
Memory used2,546,755k (±11.94%)2,364,668k (± 0.03%)~2,364,081k2,366,104kp=0.093 n=6
Parse Time5.16s (± 1.87%)5.16s (± 0.63%)~5.12s5.21sp=0.688 n=6
Bind Time1.77s (± 1.38%)1.78s (± 0.97%)~1.76s1.81sp=0.291 n=6
Check Time35.02s (± 0.86%)35.13s (± 0.54%)~34.94s35.46sp=0.423 n=6
Emit Time2.98s (± 1.28%)2.99s (± 2.18%)~2.91s3.06sp=0.936 n=6
Total Time44.95s (± 0.78%)45.09s (± 0.57%)~44.91s45.55sp=0.468 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols1,237,0191,237,032+13 (+ 0.00%)~~p=0.001 n=6
Types259,717259,718+1 (+ 0.00%)~~p=0.001 n=6
Memory used3,158,741k (± 0.01%)3,158,588k (± 0.01%)~3,158,001k3,159,040kp=0.575 n=6
Parse Time8.42s (± 0.59%)8.41s (± 0.33%)~8.38s8.46sp=0.575 n=6
Bind Time2.61s (± 1.04%)2.64s (± 1.82%)~2.59s2.71sp=0.574 n=6
Check Time52.84s (± 0.40%)52.66s (± 0.22%)~52.53s52.82sp=0.093 n=6
Emit Time4.35s (± 2.29%)4.35s (± 1.67%)~4.28s4.48sp=0.810 n=6
Total Time68.23s (± 0.24%)68.06s (± 0.16%)~67.88s68.18sp=0.093 n=6
self-compiler - node (v18.15.0, x64)
Errors00~~~p=1.000 n=6
Symbols262,423262,419-4 (- 0.00%)~~p=0.001 n=6
Types103,918103,917-1 (- 0.00%)~~p=0.001 n=6
Memory used440,602k (± 0.04%)440,530k (± 0.01%)~440,504k440,575kp=0.298 n=6
Parse Time2.90s (± 0.42%)2.87s (± 0.68%)-0.02s (- 0.75%)2.85s2.90sp=0.036 n=6
Bind Time1.11s (± 0.37%)1.12s (± 0.49%)~1.11s1.12sp=0.282 n=6
Check Time15.85s (± 0.51%)15.84s (± 0.42%)~15.75s15.95sp=0.810 n=6
Emit Time1.31s (± 1.90%)1.32s (± 0.80%)~1.30s1.33sp=1.000 n=6
Total Time21.17s (± 0.37%)21.15s (± 0.31%)~21.06s21.24sp=0.687 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors7272~~~p=1.000 n=6
Symbols225,367225,367~~~p=1.000 n=6
Types94,29094,290~~~p=1.000 n=6
Memory used370,073k (± 0.05%)370,037k (± 0.03%)~369,927k370,183kp=1.000 n=6
Parse Time2.84s (± 1.25%)2.81s (± 0.88%)~2.78s2.85sp=0.124 n=6
Bind Time1.61s (± 1.32%)1.59s (± 1.40%)~1.56s1.61sp=0.223 n=6
Check Time16.47s (± 0.45%)16.42s (± 0.52%)~16.28s16.52sp=0.261 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time20.93s (± 0.50%)20.82s (± 0.51%)~20.69s20.93sp=0.109 n=6
vscode - node (v18.15.0, x64)
Errors11~~~p=1.000 n=6
Symbols3,897,2953,897,295~~~p=1.000 n=6
Types1,227,2201,227,220~~~p=1.000 n=6
Memory used3,716,850k (± 0.01%)3,716,879k (± 0.01%)~3,716,421k3,717,337kp=0.936 n=6
Parse Time18.84s (± 0.40%)18.83s (± 0.57%)~18.71s19.02sp=1.000 n=6
Bind Time6.07s (± 0.55%)6.07s (± 0.36%)~6.05s6.11sp=1.000 n=6
Check Time124.74s (± 2.43%)126.15s (± 4.60%)~122.11s134.10sp=0.810 n=6
Emit Time41.13s (±18.06%)42.00s (±18.36%)~37.36s56.20sp=0.575 n=6
Total Time190.78s (± 3.25%)193.05s (± 5.04%)~184.33s204.80sp=0.936 n=6
webpack - node (v18.15.0, x64)
Errors3737~~~p=1.000 n=6
Symbols361,535361,535~~~p=1.000 n=6
Types158,752158,752~~~p=1.000 n=6
Memory used515,751k (± 0.02%)515,817k (± 0.03%)~515,648k516,073kp=0.575 n=6
Parse Time5.53s (± 0.27%)5.52s (± 0.87%)~5.44s5.57sp=1.000 n=6
Bind Time2.38s (± 1.61%)2.36s (± 1.07%)~2.33s2.39sp=0.332 n=6
Check Time27.04s (± 0.44%)26.99s (± 0.48%)~26.86s27.22sp=0.470 n=6
Emit Time0.00s (±154.76%)0.00s~~~p=0.174 n=6
Total Time34.95s (± 0.35%)34.88s (± 0.39%)~34.70s35.10sp=0.423 n=6
xstate-main - node (v18.15.0, x64)
Errors3030~~~p=1.000 n=6
Symbols668,465668,465~~~p=1.000 n=6
Types200,558200,558~~~p=1.000 n=6
Memory used572,153k (± 0.03%)572,212k (± 0.03%)~572,045k572,447kp=0.521 n=6
Parse Time4.18s (± 0.76%)4.16s (± 0.29%)~4.14s4.17sp=0.090 n=6
Bind Time1.33s (± 1.38%)1.33s (± 0.57%)~1.32s1.34sp=0.934 n=6
Check Time20.57s (± 1.70%)20.46s (± 1.97%)~20.01s20.87sp=0.810 n=6
Emit Time0.00s0.00s~~~p=1.000 n=6
Total Time26.07s (± 1.46%)25.94s (± 1.53%)~25.50s26.35sp=0.575 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/62435/merge:

Everything looks good!

Comment threadsrc/compiler/builder.ts Outdated
Comment threadsrc/compiler/builder.ts Outdated
@jakebailey

Copy link
Copy Markdown
MemberAuthor

This PR fails in CI but passes locally. I have no idea what's going on with that.

@sheetalkamat

Copy link
Copy Markdown
Member

Try printing diff on failing baseline and see what it is?

@jakebailey

Copy link
Copy Markdown
MemberAuthor

Oh, I just have to merge main. I'm touching new tests.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) user test this
TypeScript Bot (@typescript-bot) run dt
TypeScript Bot (@typescript-bot) test top800

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 12, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
user test this✅ Started✅ Results
run dt✅ Started👀 Results
test top800✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: miniprogram-wxs
Error:

Error: /mnt/vss/_work/1/DefinitelyTyped/types/miniprogram-wxs/miniprogram-wxs-tests.ts
7:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
10:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
✖ 2 problems (2 errors, 0 warnings)
at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250912/node_modules/@definitelytyped/dtslint/dist/index.js:199:28)
at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.33_typescript@6.0.0-dev.20250912/node_modules/@definitelytyped/dtslint/dist/index.js:191:20)

You can check the log here.

@sheetalkamat

Copy link
Copy Markdown
Member

u mean another function?

isSourceFileDefaultLibrary in program.ts

@jakebailey

Copy link
Copy Markdown
MemberAuthor

That does work, but has some strange effects. I've pushed a commit to show.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

For some reason, Windows Node 22 always fails with a timeout. I have no idea why that would be, but it is consistent.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

autoImportPackageJsonFilterExistingImport2.ts after this PR is now the longest test. 22 seconds when run on Windows in parallel testing on my machine. I have no idea why.

@github-project-automationgithub-project-automationBot moved this from Not started to Needs merge in PR BacklogSep 22, 2025
@sheetalkamat

Copy link
Copy Markdown
Member

That does work, but has some strange effects. I've pushed a commit to show.

This seems correct change

Comment on lines +147 to +148
s = replaceAll(s, lib.stringified, `${fileName}-Text`);
s = replaceAll(s, lib.file.text, `${fileName}-Text`);

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This stringify accounted for a large amount of runtime as more files are being loaded in the tests; moving it fixes the test perf issue.

Comment on lines +125 to +127
MissingPaths:: [
"lib.d.ts"
]

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sheetal Nandi (@sheetalkamat) Is this okay? I am not entirely familiar with this to know if the test needs to be updated in some way.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modified part of the test to avoid this; the file was never loaded previously and only because of no-default-lib in the other random file.

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, I am happy to revert it instead if we're okay with the random missing file message. Either way we have it, it seems.

@jakebailey

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) user test this
TypeScript Bot (@typescript-bot) run dt
TypeScript Bot (@typescript-bot) test top800

@typescript-bot

TypeScript Bot (typescript-bot) commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

CommandStatusResults
user test this✅ Started✅ Results
run dt✅ Started👀 Results
test top800✅ Started✅ Results

@typescript-bot

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: miniprogram-wxs
Error:

Error: /mnt/vss/_work/1/DefinitelyTyped/types/miniprogram-wxs/miniprogram-wxs-tests.ts
7:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
10:1 error TypeScript@local compile error: Unused '@ts-expect-error' directive @definitelytyped/expect
✖ 2 problems (2 errors, 0 warnings)
at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.34_typescript@6.0.0-dev.20250924/node_modules/@definitelytyped/dtslint/dist/index.js:199:28)
at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.34_typescript@6.0.0-dev.20250924/node_modules/@definitelytyped/dtslint/dist/index.js:191:20)

You can check the log here.

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/62435/merge:

There were infrastructure failures potentially unrelated to your change:

  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-bot

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 800 repos with tsc comparing main and refs/pull/62435/merge:

Everything looks good!

@jakebailey
Jake Bailey (jakebailey) merged commit 96acaa5 into microsoft:mainSep 24, 2025
33 checks passed
@github-project-automationgithub-project-automationBot moved this from Needs merge to Done in PR BacklogSep 24, 2025
@microsoftMicrosoft (microsoft) locked as resolved and limited conversation to collaborators Mar 24, 2026
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamBreaking ChangeWould introduce errors in existing codeFor Milestone BugPRs that fix a bug with a specific milestone

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Remove support for /// <reference no-default-lib />

5 participants

@jakebailey@typescript-bot@sheetalkamat@andrewbranch