@@ -345,6 +345,16 @@ var __extends = (this && this.__extends) || function (d, b) {
345
345
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
346
346
};` ;
347
347
348
+ const assignHelper = `
349
+ var __assign = (this && this.__assign) || Object.assign || function(t) {
350
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
351
+ s = arguments[i];
352
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
353
+ t[p] = s[p];
354
+ }
355
+ return t;
356
+ };` ;
357
+
348
358
// emit output for the __decorate helper function
349
359
const decorateHelper = `
350
360
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -540,6 +550,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
540
550
let convertedLoopState : ConvertedLoopState ;
541
551
542
552
let extendsEmitted : boolean ;
553
+ let assignEmitted : boolean ;
543
554
let decorateEmitted : boolean ;
544
555
let paramEmitted : boolean ;
545
556
let awaiterEmitted : boolean ;
@@ -623,6 +634,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
623
634
decorateEmitted = false ;
624
635
paramEmitted = false ;
625
636
awaiterEmitted = false ;
637
+ assignEmitted = false ;
626
638
tempFlags = 0 ;
627
639
tempVariables = undefined ;
628
640
tempParameters = undefined ;
@@ -1259,11 +1271,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
1259
1271
}
1260
1272
else {
1261
1273
// Either emit one big object literal (no spread attribs), or
1262
- // a call to React.__spread
1274
+ // a call to the __assign helper
1263
1275
const attrs = openingNode . attributes ;
1264
1276
if ( forEach ( attrs , attr => attr . kind === SyntaxKind . JsxSpreadAttribute ) ) {
1265
- emitExpressionIdentifier ( syntheticReactRef ) ;
1266
- write ( ".__spread(" ) ;
1277
+ write ( "__assign(" ) ;
1267
1278
1268
1279
let haveOpenedObjectLiteral = false ;
1269
1280
for ( let i = 0 ; i < attrs . length ; i ++ ) {
@@ -7610,11 +7621,16 @@ const _super = (function (geti, seti) {
7610
7621
if ( ! compilerOptions . noEmitHelpers ) {
7611
7622
// Only Emit __extends function when target ES5.
7612
7623
// For target ES6 and above, we can emit classDeclaration as is.
7613
- if ( ( languageVersion < ScriptTarget . ES6 ) && ( ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) ) {
7624
+ if ( languageVersion < ScriptTarget . ES6 && ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) {
7614
7625
writeLines ( extendsHelper ) ;
7615
7626
extendsEmitted = true ;
7616
7627
}
7617
7628
7629
+ if ( compilerOptions . jsx !== JsxEmit . Preserve && ! assignEmitted && ( node . flags & NodeFlags . HasJsxSpreadAttribute ) ) {
7630
+ writeLines ( assignHelper ) ;
7631
+ assignEmitted = true ;
7632
+ }
7633
+
7618
7634
if ( ! decorateEmitted && node . flags & NodeFlags . HasDecorators ) {
7619
7635
writeLines ( decorateHelper ) ;
7620
7636
if ( compilerOptions . emitDecoratorMetadata ) {
0 commit comments