Skip to content

Commit 43788be

Browse files
authored
Merge 4c65380 into 21822f9
2 parents 21822f9 + 4c65380 commit 43788be

File tree

5 files changed

+26
-213
lines changed

5 files changed

+26
-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.ESNext)) {
1888+
options.target = ScriptTarget.ES2022;
18891889
}
18901890
const libs = knownLibFilesForCompilerOptions(options, ts);
18911891

packages/type-compiler/tests/transpile.spec.ts

+14
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,20 @@ test('resolve import ts', () => {
2222
expect(res.logger).toContain('Logger.__type =');
2323
});
2424

25+
test('use global types with esnext target', () => {
26+
const res = transpile({
27+
'app': `
28+
interface User {}
29+
export type a = Partial<User>;
30+
`
31+
}, {
32+
target: ts.ScriptTarget.ESNext,
33+
});
34+
35+
expect(res.app).toContain('const __ΩPartial = ');
36+
expect(res.app).toContain('() => __ΩPartial');
37+
});
38+
2539
test('resolve import d.ts', () => {
2640
const res = transpile({
2741
'app': `

0 commit comments

Comments
 (0)