@@ -345,6 +345,15 @@ 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 i = 1, n = arguments.length; i < n; i++) {
351+ var s = arguments[i];
352+ if (s != null) for (var p in s) if (s.hasOwnProperty(p)) t[p] = s[p];
353+ }
354+ return t;
355+ };` ;
356+
348357 // emit output for the __decorate helper function
349358 const decorateHelper = `
350359var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
@@ -540,6 +549,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
540549 let convertedLoopState : ConvertedLoopState ;
541550
542551 let extendsEmitted : boolean ;
552+ let assignEmitted : boolean ;
543553 let decorateEmitted : boolean ;
544554 let paramEmitted : boolean ;
545555 let awaiterEmitted : boolean ;
@@ -623,6 +633,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
623633 decorateEmitted = false ;
624634 paramEmitted = false ;
625635 awaiterEmitted = false ;
636+ assignEmitted = false ;
626637 tempFlags = 0 ;
627638 tempVariables = undefined ;
628639 tempParameters = undefined ;
@@ -1259,11 +1270,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
12591270 }
12601271 else {
12611272 // Either emit one big object literal (no spread attribs), or
1262- // a call to React.__spread
1273+ // a call to the __assign helper
12631274 const attrs = openingNode . attributes ;
12641275 if ( forEach ( attrs , attr => attr . kind === SyntaxKind . JsxSpreadAttribute ) ) {
1265- emitExpressionIdentifier ( syntheticReactRef ) ;
1266- write ( ".__spread(" ) ;
1276+ write ( "__assign(" ) ;
12671277
12681278 let haveOpenedObjectLiteral = false ;
12691279 for ( let i = 0 ; i < attrs . length ; i ++ ) {
@@ -7610,11 +7620,16 @@ const _super = (function (geti, seti) {
76107620 if ( ! compilerOptions . noEmitHelpers ) {
76117621 // Only Emit __extends function when target ES5.
76127622 // For target ES6 and above, we can emit classDeclaration as is.
7613- if ( ( languageVersion < ScriptTarget . ES6 ) && ( ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) ) {
7623+ if ( languageVersion < ScriptTarget . ES6 && ! extendsEmitted && node . flags & NodeFlags . HasClassExtends ) {
76147624 writeLines ( extendsHelper ) ;
76157625 extendsEmitted = true ;
76167626 }
76177627
7628+ if ( compilerOptions . jsx !== JsxEmit . Preserve && ! assignEmitted && ( node . flags & NodeFlags . HasJsxSpreadAttribute ) ) {
7629+ writeLines ( assignHelper ) ;
7630+ assignEmitted = true ;
7631+ }
7632+
76187633 if ( ! decorateEmitted && node . flags & NodeFlags . HasDecorators ) {
76197634 writeLines ( decorateHelper ) ;
76207635 if ( compilerOptions . emitDecoratorMetadata ) {
0 commit comments