diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 95faebd2875..e7f3558a3e6 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -19970,9 +19970,13 @@ namespace ts { if (requestedExternalEmitHelpers & NodeFlags.HasClassExtends && languageVersion < ScriptTarget.ES2015) { verifyHelperSymbol(exports, "__extends", SymbolFlags.Value); } - if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute && compilerOptions.jsx !== JsxEmit.Preserve) { + if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute && + (languageVersion < ScriptTarget.ESNext || compilerOptions.jsx === JsxEmit.React)) { verifyHelperSymbol(exports, "__assign", SymbolFlags.Value); } + if (languageVersion < ScriptTarget.ESNext && requestedExternalEmitHelpers & NodeFlags.HasRestAttribute) { + verifyHelperSymbol(exports, "__rest", SymbolFlags.Value); + } if (requestedExternalEmitHelpers & NodeFlags.HasDecorators) { verifyHelperSymbol(exports, "__decorate", SymbolFlags.Value); if (compilerOptions.emitDecoratorMetadata) { diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 9889d3ad1af..7db19af7382 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -433,7 +433,7 @@ namespace ts { BlockScoped = Let | Const, ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn, - EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute, + EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute | HasRestAttribute, ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags, // Parsing context flags