Skip to content

Commit 0d4ac01

Browse files
committed
Report errors for import helpers missing __rest
1 parent c87bce1 commit 0d4ac01

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/compiler/checker.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19970,9 +19970,13 @@ namespace ts {
1997019970
if (requestedExternalEmitHelpers & NodeFlags.HasClassExtends && languageVersion < ScriptTarget.ES2015) {
1997119971
verifyHelperSymbol(exports, "__extends", SymbolFlags.Value);
1997219972
}
19973-
if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute && compilerOptions.jsx !== JsxEmit.Preserve) {
19973+
if (requestedExternalEmitHelpers & NodeFlags.HasSpreadAttribute &&
19974+
(languageVersion < ScriptTarget.ESNext || compilerOptions.jsx === JsxEmit.React)) {
1997419975
verifyHelperSymbol(exports, "__assign", SymbolFlags.Value);
1997519976
}
19977+
if (languageVersion < ScriptTarget.ESNext && requestedExternalEmitHelpers & NodeFlags.HasRestAttribute) {
19978+
verifyHelperSymbol(exports, "__rest", SymbolFlags.Value);
19979+
}
1997619980
if (requestedExternalEmitHelpers & NodeFlags.HasDecorators) {
1997719981
verifyHelperSymbol(exports, "__decorate", SymbolFlags.Value);
1997819982
if (compilerOptions.emitDecoratorMetadata) {

src/compiler/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ namespace ts {
433433
BlockScoped = Let | Const,
434434

435435
ReachabilityCheckFlags = HasImplicitReturn | HasExplicitReturn,
436-
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute,
436+
EmitHelperFlags = HasClassExtends | HasDecorators | HasParamDecorators | HasAsyncFunctions | HasSpreadAttribute | HasRestAttribute,
437437
ReachabilityAndEmitFlags = ReachabilityCheckFlags | EmitHelperFlags,
438438

439439
// Parsing context flags

0 commit comments

Comments
 (0)