Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit cca68ad

Browse filesBrowse files
committed
Import helpers skips __assign when target >= ES6
Instead, Object.assign is emitted.
1 parent 46cdac1 commit cca68ad
Copy full SHA for cca68ad

5 files changed

+28-13Lines changed: 28 additions & 13 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎src/compiler/checker.ts‎

Copy file name to clipboardExpand all lines: src/compiler/checker.ts
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11721,7 +11721,7 @@ namespace ts {
1172111721
member = prop;
1172211722
}
1172311723
else if (memberDecl.kind === SyntaxKind.SpreadAssignment) {
11724-
if (languageVersion < ScriptTarget.ESNext) {
11724+
if (languageVersion < ScriptTarget.ES2015) {
1172511725
checkExternalEmitHelpers(memberDecl, ExternalEmitHelpers.Assign);
1172611726
}
1172711727
if (propertiesArray.length > 0) {
Collapse file

‎tests/baselines/reference/importHelpersES6.js‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/importHelpersES6.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ declare var dec: any;
55
@dec export class A {
66

77
}
8+
9+
const o = { a: 1 };
10+
const y = { ...o };
811

912
//// [tslib.d.ts]
1013
export declare function __extends(d: Function, b: Function): void;
11-
export declare function __assign(t: any, ...sources: any[]): any;
1214
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
1315
export declare function __param(paramIndex: number, decorator: Function): Function;
1416
export declare function __metadata(metadataKey: any, metadataValue: any): Function;
@@ -23,3 +25,5 @@ A = tslib_1.__decorate([
2325
dec
2426
], A);
2527
export { A };
28+
const o = { a: 1 };
29+
const y = Object.assign({}, o);
Collapse file

‎tests/baselines/reference/importHelpersES6.symbols‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/importHelpersES6.symbols
+8-5Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ declare var dec: any;
88

99
}
1010

11+
const o = { a: 1 };
12+
>o : Symbol(o, Decl(a.ts, 5, 5))
13+
>a : Symbol(a, Decl(a.ts, 5, 11))
14+
15+
const y = { ...o };
16+
>y : Symbol(y, Decl(a.ts, 6, 5))
17+
>o : Symbol(o, Decl(a.ts, 5, 5))
18+
1119
=== tests/cases/compiler/tslib.d.ts ===
1220
export declare function __extends(d: Function, b: Function): void;
1321
>__extends : Symbol(__extends, Decl(tslib.d.ts, --, --))
@@ -16,11 +24,6 @@ export declare function __extends(d: Function, b: Function): void;
1624
>b : Symbol(b, Decl(tslib.d.ts, --, --))
1725
>Function : Symbol(Function, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --), Decl(lib.es2015.symbol.wellknown.d.ts, --, --), Decl(lib.es2015.core.d.ts, --, --))
1826

19-
export declare function __assign(t: any, ...sources: any[]): any;
20-
>__assign : Symbol(__assign, Decl(tslib.d.ts, --, --))
21-
>t : Symbol(t, Decl(tslib.d.ts, --, --))
22-
>sources : Symbol(sources, Decl(tslib.d.ts, --, --))
23-
2427
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
2528
>__decorate : Symbol(__decorate, Decl(tslib.d.ts, --, --))
2629
>decorators : Symbol(decorators, Decl(tslib.d.ts, --, --))
Collapse file

‎tests/baselines/reference/importHelpersES6.types‎

Copy file name to clipboardExpand all lines: tests/baselines/reference/importHelpersES6.types
+11-5Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,17 @@ declare var dec: any;
88

99
}
1010

11+
const o = { a: 1 };
12+
>o : { a: number; }
13+
>{ a: 1 } : { a: number; }
14+
>a : number
15+
>1 : 1
16+
17+
const y = { ...o };
18+
>y : { a: number; }
19+
>{ ...o } : { a: number; }
20+
>o : { a: number; }
21+
1122
=== tests/cases/compiler/tslib.d.ts ===
1223
export declare function __extends(d: Function, b: Function): void;
1324
>__extends : (d: Function, b: Function) => void
@@ -16,11 +27,6 @@ export declare function __extends(d: Function, b: Function): void;
1627
>b : Function
1728
>Function : Function
1829

19-
export declare function __assign(t: any, ...sources: any[]): any;
20-
>__assign : (t: any, ...sources: any[]) => any
21-
>t : any
22-
>sources : any[]
23-
2430
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
2531
>__decorate : (decorators: Function[], target: any, key?: string | symbol, desc?: any) => any
2632
>decorators : Function[]
Collapse file

‎tests/cases/compiler/importHelpersES6.ts‎

Copy file name to clipboardExpand all lines: tests/cases/compiler/importHelpersES6.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ declare var dec: any;
77

88
}
99

10+
const o = { a: 1 };
11+
const y = { ...o };
12+
1013
// @filename: tslib.d.ts
1114
export declare function __extends(d: Function, b: Function): void;
12-
export declare function __assign(t: any, ...sources: any[]): any;
1315
export declare function __decorate(decorators: Function[], target: any, key?: string | symbol, desc?: any): any;
1416
export declare function __param(paramIndex: number, decorator: Function): Function;
1517
export declare function __metadata(metadataKey: any, metadataValue: any): Function;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.