Replace lib file instead of changing target

This commit is contained in:
Andrew Branch 2023-06-26 14:30:23 -07:00
parent d3c08b2d22
commit 34cf76ca3b
No known key found for this signature in database
GPG Key ID: 22CCA4B120C427D2
5 changed files with 36 additions and 32 deletions

View File

@ -295,14 +295,13 @@ a;b;
}),
"/Users/name/projects/web/tsconfig.json": JSON.stringify({
compilerOptions: {
target: "es5",
module: "nodenext",
moduleResolution: "nodenext",
forceConsistentCasingInFileNames: true,
traceResolution: true,
}
}),
[libFile.path]: libFile.content,
[libFile.path.replace("lib.d.ts", "lib.esnext.full.d.ts")]: libFile.content,
}, { currentDirectory: "/Users/name/projects/web" }),
});

View File

@ -89,7 +89,6 @@ describe("unittests:: tsc-watch:: moduleResolution", () => {
path: `/user/username/projects/myproject/tsconfig.json`,
content: JSON.stringify({
compilerOptions: {
target: "es5",
module: "nodenext",
moduleResolution: "nodenext",
outDir: "./dist",
@ -125,7 +124,10 @@ describe("unittests:: tsc-watch:: moduleResolution", () => {
export function thing(): void {}
`
},
libFile
{
...libFile,
path: libFile.path.replace("lib.d.ts", "lib.esnext.full.d.ts")
}
], { currentDirectory: "/user/username/projects/myproject" }),
commandLineArgs: ["-w", "--traceResolution"],
edits: [{
@ -354,7 +356,7 @@ describe("unittests:: tsc-watch:: moduleResolution", () => {
{
path: `/user/username/projects/myproject/tsconfig.json`,
content: JSON.stringify({
compilerOptions: { target: "es5", module: "node16", moduleResolution: "node16" },
compilerOptions: { module: "node16", moduleResolution: "node16" },
})
},
{
@ -424,7 +426,10 @@ describe("unittests:: tsc-watch:: moduleResolution", () => {
path: `/user/username/projects/myproject/node_modules/@types/pkg2/index.d.ts`,
content: `export const x = 10;`
},
libFile
{
...libFile,
path: libFile.path.replace("lib.d.ts", "lib.es2022.full.d.ts"),
}
], { currentDirectory: "/user/username/projects/myproject" }),
commandLineArgs: ["-w", "--traceResolution"],
edits: [

View File

@ -13,9 +13,9 @@ export function foo(): void;
{"name":"yargs","version":"17.0.12","exports":{".":{"types":{"import":"./index.d.mts","default":"./index.d.ts"}}}}
//// [/Users/name/projects/web/tsconfig.json]
{"compilerOptions":{"target":"es5","module":"nodenext","moduleResolution":"nodenext","forceConsistentCasingInFileNames":true,"traceResolution":true}}
{"compilerOptions":{"module":"nodenext","moduleResolution":"nodenext","forceConsistentCasingInFileNames":true,"traceResolution":true}}
//// [/a/lib/lib.d.ts]
//// [/a/lib/lib.esnext.full.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
@ -83,8 +83,8 @@ Resolving real path for '/Users/name/projects/web/node_modules/@types/yargs/inde
File '/a/lib/package.json' does not exist.
File '/a/package.json' does not exist.
File '/package.json' does not exist according to earlier cached lookups.
../../../../a/lib/lib.d.ts
Default library for target 'es5'
../../../../a/lib/lib.esnext.full.d.ts
Default library for target 'esnext'
node_modules/@types/yargs/index.d.ts
Imported via "yargs" from file 'src/bin.ts' with packageId 'yargs/index.d.ts@17.0.12'
Entry point for implicit type library 'yargs' with packageId 'yargs/index.d.ts@17.0.12'
@ -97,20 +97,20 @@ src/bin.ts
Program root files: ["/Users/name/projects/web/src/bin.ts"]
Program options: {"target":1,"module":199,"moduleResolution":99,"forceConsistentCasingInFileNames":true,"traceResolution":true,"watch":true,"explainFiles":true,"configFilePath":"/Users/name/projects/web/tsconfig.json"}
Program options: {"module":199,"moduleResolution":99,"forceConsistentCasingInFileNames":true,"traceResolution":true,"watch":true,"explainFiles":true,"configFilePath":"/Users/name/projects/web/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.d.ts
/a/lib/lib.esnext.full.d.ts
/Users/name/projects/web/node_modules/@types/yargs/index.d.ts
/Users/name/projects/web/src/bin.ts
Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/a/lib/lib.esnext.full.d.ts
/Users/name/projects/web/node_modules/@types/yargs/index.d.ts
/Users/name/projects/web/src/bin.ts
Shape signatures in builder refreshed for::
/a/lib/lib.d.ts (used version)
/a/lib/lib.esnext.full.d.ts (used version)
/users/name/projects/web/node_modules/@types/yargs/index.d.ts (used version)
/users/name/projects/web/src/bin.ts (used version)
@ -125,7 +125,7 @@ PolledWatches::
{"pollingInterval":2000}
FsWatches::
/a/lib/lib.d.ts: *new*
/a/lib/lib.esnext.full.d.ts: *new*
{}
/users/name/projects: *new*
{}

View File

@ -1,7 +1,7 @@
currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false
Input::
//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{"target":"es5","module":"nodenext","moduleResolution":"nodenext","outDir":"./dist","declaration":true,"declarationDir":"./types"}}
{"compilerOptions":{"module":"nodenext","moduleResolution":"nodenext","outDir":"./dist","declaration":true,"declarationDir":"./types"}}
//// [/user/username/projects/myproject/package.json]
{"name":"@this/package","type":"module","exports":{".":{"default":"./dist/index.js","types":"./types/index.d.ts"}}}
@ -16,7 +16,7 @@ export function thing(): void {}
export function thing(): void {}
//// [/a/lib/lib.d.ts]
//// [/a/lib/lib.esnext.full.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
@ -59,17 +59,17 @@ File '/package.json' does not exist.
Program root files: ["/user/username/projects/myproject/index.ts","/user/username/projects/myproject/index2.ts"]
Program options: {"target":1,"module":199,"moduleResolution":99,"outDir":"/user/username/projects/myproject/dist","declaration":true,"declarationDir":"/user/username/projects/myproject/types","watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program options: {"module":199,"moduleResolution":99,"outDir":"/user/username/projects/myproject/dist","declaration":true,"declarationDir":"/user/username/projects/myproject/types","watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.d.ts
/a/lib/lib.esnext.full.d.ts
/user/username/projects/myproject/index.ts
/user/username/projects/myproject/index2.ts
No cached semantic diagnostics in the builder::
Shape signatures in builder refreshed for::
/a/lib/lib.d.ts (used version)
/a/lib/lib.esnext.full.d.ts (used version)
/user/username/projects/myproject/index.ts (computed .d.ts during emit)
/user/username/projects/myproject/index2.ts (computed .d.ts during emit)
@ -80,7 +80,7 @@ PolledWatches::
{"pollingInterval":500}
FsWatches::
/a/lib/lib.d.ts: *new*
/a/lib/lib.esnext.full.d.ts: *new*
{}
/user/username/projects/myproject/index.ts: *new*
{}
@ -156,10 +156,10 @@ File '/package.json' does not exist according to earlier cached lookups.
Program root files: ["/user/username/projects/myproject/index.ts","/user/username/projects/myproject/index2.ts"]
Program options: {"target":1,"module":199,"moduleResolution":99,"outDir":"/user/username/projects/myproject/dist","declaration":true,"declarationDir":"/user/username/projects/myproject/types","watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program options: {"module":199,"moduleResolution":99,"outDir":"/user/username/projects/myproject/dist","declaration":true,"declarationDir":"/user/username/projects/myproject/types","watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.d.ts
/a/lib/lib.esnext.full.d.ts
/user/username/projects/myproject/index.ts
/user/username/projects/myproject/index2.ts

View File

@ -1,7 +1,7 @@
currentDirectory:: /user/username/projects/myproject useCaseSensitiveFileNames: false
Input::
//// [/user/username/projects/myproject/tsconfig.json]
{"compilerOptions":{"target":"es5","module":"node16","moduleResolution":"node16"}}
{"compilerOptions":{"module":"node16","moduleResolution":"node16"}}
//// [/user/username/projects/myproject/index.ts]
/// <reference types="pkg" resolution-mode="import"/>
@ -43,7 +43,7 @@ declare global {
//// [/user/username/projects/myproject/node_modules/@types/pkg2/index.d.ts]
export const x = 10;
//// [/a/lib/lib.d.ts]
//// [/a/lib/lib.es2022.full.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
@ -146,24 +146,24 @@ File '/package.json' does not exist according to earlier cached lookups.
Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/index.ts"]
Program options: {"target":1,"module":100,"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program options: {"module":100,"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: Not
Program files::
/a/lib/lib.d.ts
/a/lib/lib.es2022.full.d.ts
/user/username/projects/myproject/a.ts
/user/username/projects/myproject/node_modules/pkg/import.d.ts
/user/username/projects/myproject/index.ts
/user/username/projects/myproject/node_modules/@types/pkg2/index.d.ts
Semantic diagnostics in builder refreshed for::
/a/lib/lib.d.ts
/a/lib/lib.es2022.full.d.ts
/user/username/projects/myproject/a.ts
/user/username/projects/myproject/node_modules/pkg/import.d.ts
/user/username/projects/myproject/index.ts
/user/username/projects/myproject/node_modules/@types/pkg2/index.d.ts
Shape signatures in builder refreshed for::
/a/lib/lib.d.ts (used version)
/a/lib/lib.es2022.full.d.ts (used version)
/user/username/projects/myproject/a.ts (used version)
/user/username/projects/myproject/node_modules/pkg/import.d.ts (used version)
/user/username/projects/myproject/index.ts (used version)
@ -186,7 +186,7 @@ PolledWatches::
{"pollingInterval":2000}
FsWatches::
/a/lib/lib.d.ts: *new*
/a/lib/lib.es2022.full.d.ts: *new*
{}
/user/username/projects/myproject/a.ts: *new*
{}
@ -324,10 +324,10 @@ File '/package.json' does not exist according to earlier cached lookups.
Program root files: ["/user/username/projects/myproject/a.ts","/user/username/projects/myproject/index.ts"]
Program options: {"target":1,"module":100,"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program options: {"module":100,"moduleResolution":3,"watch":true,"traceResolution":true,"configFilePath":"/user/username/projects/myproject/tsconfig.json"}
Program structureReused: SafeModules
Program files::
/a/lib/lib.d.ts
/a/lib/lib.es2022.full.d.ts
/user/username/projects/myproject/node_modules/pkg/import.d.ts
/user/username/projects/myproject/a.ts
/user/username/projects/myproject/index.ts