@@ -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) {
@@ -542,6 +552,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
542552 let convertedLoopState : ConvertedLoopState ;
543553
544554 let extendsEmitted : boolean ;
555+ let assignEmitted : boolean ;
545556 let decorateEmitted : boolean ;
546557 let paramEmitted : boolean ;
547558 let awaiterEmitted : boolean ;
@@ -625,6 +636,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
625636 decorateEmitted = false ;
626637 paramEmitted = false ;
627638 awaiterEmitted = false ;
639+ assignEmitted = false ;
628640 tempFlags = 0 ;
629641 tempVariables = undefined ;
630642 tempParameters = undefined ;
@@ -1261,11 +1273,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12611273 }
12621274 else {
12631275 // Either emit one big object literal (no spread attribs), or
1264- // a call to React.__spread
1276+ // a call to the __assign helper
12651277 const attrs = openingNode . attributes ;
12661278 if ( forEach ( attrs , attr => attr . kind === SyntaxKind . JsxSpreadAttribute ) ) {
1267- emitExpressionIdentifier ( syntheticReactRef ) ;
1268- write ( ".__spread(" ) ;
1279+ write ( "__assign(" ) ;
12691280
12701281 let haveOpenedObjectLiteral = false ;
12711282 for ( let i = 0 ; i < attrs . length ; i ++ ) {
@@ -7704,11 +7715,16 @@ const _super = (function (geti, seti) {
77047715 if ( ! compilerOptions . noEmitHelpers ) {
77057716 // Only Emit __extends function when target ES5.
77067717 // For target ES6 and above, we can emit classDeclaration as is.
7707- if ( ( languageVersion < ScriptTarget . ES6 ) && ( ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) ) {
7718+ if ( languageVersion < ScriptTarget . ES6 && ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) {
77087719 writeLines ( extendsHelper ) ;
77097720 extendsEmitted = true ;
77107721 }
77117722
7723+ if ( compilerOptions . jsx !== JsxEmit . Preserve && ! assignEmitted && ( node . flags & NodeFlags . HasJsxSpreadAttribute ) ) {
7724+ writeLines ( assignHelper ) ;
7725+ assignEmitted = true ;
7726+ }
7727+
77127728 if ( ! decorateEmitted && node . flags & NodeFlags . HasDecorators ) {
77137729 writeLines ( decorateHelper ) ;
77147730 if ( compilerOptions . emitDecoratorMetadata ) {
0 commit comments