@@ -345,6 +345,16 @@ var __extends = (this && this.__extends) || function (d, b) {
345345 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
346346};` ;
347347
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+
348358 // emit output for the __decorate helper function
349359 const decorateHelper = `
350360var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -540,6 +550,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
540550 let convertedLoopState : ConvertedLoopState ;
541551
542552 let extendsEmitted : boolean ;
553+ let assignEmitted : boolean ;
543554 let decorateEmitted : boolean ;
544555 let paramEmitted : boolean ;
545556 let awaiterEmitted : boolean ;
@@ -623,6 +634,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
623634 decorateEmitted = false ;
624635 paramEmitted = false ;
625636 awaiterEmitted = false ;
637+ assignEmitted = false ;
626638 tempFlags = 0 ;
627639 tempVariables = undefined ;
628640 tempParameters = undefined ;
@@ -1259,11 +1271,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12591271 }
12601272 else {
12611273 // Either emit one big object literal (no spread attribs), or
1262- // a call to React.__spread
1274+ // a call to the __assign helper
12631275 const attrs = openingNode . attributes ;
12641276 if ( forEach ( attrs , attr => attr . kind === SyntaxKind . JsxSpreadAttribute ) ) {
1265- emitExpressionIdentifier ( syntheticReactRef ) ;
1266- write ( ".__spread(" ) ;
1277+ write ( "__assign(" ) ;
12671278
12681279 let haveOpenedObjectLiteral = false ;
12691280 for ( let i = 0 ; i < attrs . length ; i ++ ) {
@@ -7610,11 +7621,16 @@ const _super = (function (geti, seti) {
76107621 if ( ! compilerOptions . noEmitHelpers ) {
76117622 // Only Emit __extends function when target ES5.
76127623 // 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 ) {
76147625 writeLines ( extendsHelper ) ;
76157626 extendsEmitted = true ;
76167627 }
76177628
7629+ if ( compilerOptions . jsx !== JsxEmit . Preserve && ! assignEmitted && ( node . flags & NodeFlags . HasJsxSpreadAttribute ) ) {
7630+ writeLines ( assignHelper ) ;
7631+ assignEmitted = true ;
7632+ }
7633+
76187634 if ( ! decorateEmitted && node . flags & NodeFlags . HasDecorators ) {
76197635 writeLines ( decorateHelper ) ;
76207636 if ( compilerOptions . emitDecoratorMetadata ) {
0 commit comments