Skip to content

Commit 7441db8

Browse files
authored
Merge pull request microsoft#24870 from Microsoft/Fix24826
Fix microsoft#24826: Add mapping for ES2018 target to library
2 parents cca2631 + 64dab63 commit 7441db8

File tree

5 files changed

+56
-0
lines changed

5 files changed

+56
-0
lines changed

src/parser/utilities.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4325,6 +4325,8 @@ namespace ts {
43254325
switch (options.target) {
43264326
case ScriptTarget.ESNext:
43274327
return "lib.esnext.full.d.ts";
4328+
case ScriptTarget.ES2018:
4329+
return "lib.es2018.full.d.ts";
43284330
case ScriptTarget.ES2017:
43294331
return "lib.es2017.full.d.ts";
43304332
case ScriptTarget.ES2016:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
//// [es2018ObjectAssign.ts]
2+
const test = Object.assign({}, { test: true });
3+
4+
declare const p: Promise<number>;
5+
p.finally();
6+
7+
//// [es2018ObjectAssign.js]
8+
const test = Object.assign({}, { test: true });
9+
p.finally();
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
=== tests/cases/compiler/es2018ObjectAssign.ts ===
2+
const test = Object.assign({}, { test: true });
3+
>test : Symbol(test, Decl(es2018ObjectAssign.ts, 0, 5))
4+
>Object.assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
5+
>Object : Symbol(Object, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
6+
>assign : Symbol(ObjectConstructor.assign, Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
7+
>test : Symbol(test, Decl(es2018ObjectAssign.ts, 0, 32))
8+
9+
declare const p: Promise<number>;
10+
>p : Symbol(p, Decl(es2018ObjectAssign.ts, 2, 13))
11+
>Promise : Symbol(Promise, Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.iterable.d.ts, --, --), Decl(lib.es2015.promise.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2018.promise.d.ts, --, --))
12+
13+
p.finally();
14+
>p.finally : Symbol(Promise.finally, Decl(lib.es2018.promise.d.ts, --, --))
15+
>p : Symbol(p, Decl(es2018ObjectAssign.ts, 2, 13))
16+
>finally : Symbol(Promise.finally, Decl(lib.es2018.promise.d.ts, --, --))
17+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
=== tests/cases/compiler/es2018ObjectAssign.ts ===
2+
const test = Object.assign({}, { test: true });
3+
>test : { test: boolean; }
4+
>Object.assign({}, { test: true }) : { test: boolean; }
5+
>Object.assign : { <T, U>(target: T, source: U): T & U; <T, U, V>(target: T, source1: U, source2: V): T & U & V; <T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; }
6+
>Object : ObjectConstructor
7+
>assign : { <T, U>(target: T, source: U): T & U; <T, U, V>(target: T, source1: U, source2: V): T & U & V; <T, U, V, W>(target: T, source1: U, source2: V, source3: W): T & U & V & W; (target: object, ...sources: any[]): any; }
8+
>{} : {}
9+
>{ test: true } : { test: true; }
10+
>test : true
11+
>true : true
12+
13+
declare const p: Promise<number>;
14+
>p : Promise<number>
15+
>Promise : Promise<T>
16+
17+
p.finally();
18+
>p.finally() : Promise<number>
19+
>p.finally : (onfinally?: () => void) => Promise<number>
20+
>p : Promise<number>
21+
>finally : (onfinally?: () => void) => Promise<number>
22+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// @target: es2018
2+
3+
const test = Object.assign({}, { test: true });
4+
5+
declare const p: Promise<number>;
6+
p.finally();

0 commit comments

Comments
 (0)