Skip to content

Fix incorrect condition of noLib #58867

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2777,7 +2777,7 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg
return true;
}

if (!options.noLib) {
if (options.noLib) {
return false;
}

Expand Down
26 changes: 26 additions & 0 deletions src/testRunner/unittests/tsc/incremental.ts
Original file line number Diff line number Diff line change
Expand Up @@ -676,4 +676,30 @@ console.log(a);`,
verify(/*withAlias*/ AliasType.SameFile, /*preserveConstEnums*/ true);
verify(/*withAlias*/ AliasType.DifferentFile, /*preserveConstEnums*/ true);
});

verifyTsc({
scenario: "incremental",
subScenario: "when noLib toggles",
fs: () =>
loadProjectFromFiles({
"/src/a.d.ts": `declare const a = "hello";`,
"/src/b.ts": `const b = 10;`,
"/src/tsconfig.json": jsonToReadableText({
compilerOptions: {
declaration: true,
incremental: true,
lib: ["es6"],
},
}),
"/lib/lib.es2015.d.ts": libContent,
}),
commandLineArgs: ["-p", "/src/tsconfig.json"],
edits: [
{
...noChangeRun,
commandLineArgs: ["-p", "/src/tsconfig.json", "--noLib"],
},
],
baselinePrograms: true,
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,14 @@ Semantic diagnostics in builder refreshed for::
Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-scripthost/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project1/core.d.ts (used version)
/home/src/projects/project1/file.ts (computed .d.ts during emit)
/home/src/projects/project1/file2.ts (computed .d.ts during emit)
/home/src/projects/project1/index.ts (computed .d.ts during emit)
/home/src/projects/project1/utils.d.ts (used version)
/home/src/projects/project1/typeroot1/sometype/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project2/index.ts",
Expand Down Expand Up @@ -481,9 +481,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project2/index.ts (computed .d.ts during emit)
/home/src/projects/project2/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project3/index.ts",
Expand Down Expand Up @@ -515,9 +515,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project3/index.ts (computed .d.ts during emit)
/home/src/projects/project3/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project4/index.ts",
Expand Down Expand Up @@ -552,10 +552,10 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-esnext/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)
/home/src/projects/project4/index.ts (computed .d.ts during emit)
/home/src/projects/project4/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)


//// [/home/src/projects/project1/file.d.ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)
/home/src/lib/lib.scripthost.d.ts (used version)
/home/src/projects/project1/core.d.ts (used version)
Expand All @@ -466,6 +465,7 @@ Shape signatures in builder refreshed for::
/home/src/projects/project1/index.ts (computed .d.ts during emit)
/home/src/projects/project1/utils.d.ts (used version)
/home/src/projects/project1/typeroot1/sometype/index.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project2/index.ts",
Expand Down Expand Up @@ -497,9 +497,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/projects/project2/index.ts (computed .d.ts during emit)
/home/src/projects/project2/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project3/index.ts",
Expand Down Expand Up @@ -531,9 +531,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/projects/project3/index.ts (computed .d.ts during emit)
/home/src/projects/project3/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project4/index.ts",
Expand Down Expand Up @@ -568,10 +568,10 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.esnext.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)
/home/src/projects/project4/index.ts (computed .d.ts during emit)
/home/src/projects/project4/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)


//// [/home/src/projects/project1/file.d.ts]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -894,14 +894,14 @@ Semantic diagnostics in builder refreshed for::
Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-scripthost/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project1/core.d.ts (used version)
/home/src/projects/project1/file.ts (computed .d.ts during emit)
/home/src/projects/project1/file2.ts (computed .d.ts during emit)
/home/src/projects/project1/index.ts (computed .d.ts during emit)
/home/src/projects/project1/utils.d.ts (used version)
/home/src/projects/project1/typeroot1/sometype/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project2/index.ts",
Expand Down Expand Up @@ -935,9 +935,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project2/index.ts (computed .d.ts during emit)
/home/src/projects/project2/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project3/index.ts",
Expand Down Expand Up @@ -971,9 +971,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-es5/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/project3/index.ts (computed .d.ts during emit)
/home/src/projects/project3/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)

Program root files: [
"/home/src/projects/project4/index.ts",
Expand Down Expand Up @@ -1010,9 +1010,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/projects/node_modules/@typescript/lib-esnext/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)
/home/src/projects/project4/index.ts (computed .d.ts during emit)
/home/src/projects/project4/utils.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-dom/index.d.ts (used version)
/home/src/projects/node_modules/@typescript/lib-webworker/index.d.ts (used version)

exitCode:: ExitStatus.undefined
Original file line number Diff line number Diff line change
Expand Up @@ -909,7 +909,6 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)
/home/src/lib/lib.scripthost.d.ts (used version)
/home/src/projects/project1/core.d.ts (used version)
Expand All @@ -918,6 +917,7 @@ Shape signatures in builder refreshed for::
/home/src/projects/project1/index.ts (computed .d.ts during emit)
/home/src/projects/project1/utils.d.ts (used version)
/home/src/projects/project1/typeroot1/sometype/index.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project2/index.ts",
Expand Down Expand Up @@ -951,9 +951,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/projects/project2/index.ts (computed .d.ts during emit)
/home/src/projects/project2/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project3/index.ts",
Expand Down Expand Up @@ -987,9 +987,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.es5.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/projects/project3/index.ts (computed .d.ts during emit)
/home/src/projects/project3/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)

Program root files: [
"/home/src/projects/project4/index.ts",
Expand Down Expand Up @@ -1026,9 +1026,9 @@ Semantic diagnostics in builder refreshed for::

Shape signatures in builder refreshed for::
/home/src/lib/lib.esnext.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)
/home/src/projects/project4/index.ts (computed .d.ts during emit)
/home/src/projects/project4/utils.d.ts (used version)
/home/src/lib/lib.dom.d.ts (used version)
/home/src/lib/lib.webworker.d.ts (used version)

exitCode:: ExitStatus.undefined
Loading