Skip to content

Commit 1ae116c

Browse files
committed
fix(type-compiler): set ts compiler options target to es2022 if higher than es20222 when resolving global lib files
1 parent 21822f9 commit 1ae116c

File tree

5 files changed

+25
-213
lines changed

5 files changed

+25
-213
lines changed

package-lock.json

+6-207
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/type-compiler/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"dependencies": {
3838
"@deepkit/type-spec": "^1.0.1-alpha.108",
3939
"@marcj/ts-clone-node": "^2.0.0",
40-
"@typescript/vfs": "^1.4.0",
40+
"@typescript/vfs": "1.5.0",
4141
"get-tsconfig": "^4.5.0",
4242
"lz-string": "^1.4.4",
4343
"micromatch": "^4.0.5",

packages/type-compiler/src/compiler.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1881,11 +1881,11 @@ export class ReflectionTransformer implements CustomTransformer {
18811881

18821882
//todo also read compiler options "types" + typeRoot
18831883

1884-
//currently knownLibFilesForCompilerOptions from @typescript/vfs doesn't return correct lib files for ES2022,
1885-
//so we switch here to es2021 if bigger than es2021.
1884+
//currently knownLibFilesForCompilerOptions from @typescript/vfs doesn't return correct lib files for esnext,
1885+
//so we switch here to es2022 if bigger than es2022.
18861886
const options = { ...this.compilerOptions };
1887-
if (options.target && (options.target > ScriptTarget.ES2021 && options.target < ScriptTarget.ESNext)) {
1888-
options.target = ScriptTarget.ES2021;
1887+
if (options.target && (options.target > ScriptTarget.ES2022)) {
1888+
options.target = ScriptTarget.ES2022;
18891889
}
18901890
const libs = knownLibFilesForCompilerOptions(options, ts);
18911891

0 commit comments

Comments
 (0)