@@ -5487,6 +5487,9 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
54875487 }
54885488
54895489 write ( "[\"require\", \"exports\"" ) ;
5490+ if ( compilerOptions . noEmitHelpers ) {
5491+ write ( ", \"__extends\"" ) ;
5492+ }
54905493 if ( aliasedModuleNames . length ) {
54915494 write ( ", " ) ;
54925495 write ( aliasedModuleNames . join ( ", " ) ) ;
@@ -5496,6 +5499,9 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
54965499 write ( unaliasedModuleNames . join ( ", " ) ) ;
54975500 }
54985501 write ( "], function (require, exports" ) ;
5502+ if ( compilerOptions . noEmitHelpers ) {
5503+ write ( ", __extends" ) ;
5504+ }
54995505 if ( importAliasNames . length ) {
55005506 write ( ", " ) ;
55015507 write ( importAliasNames . join ( ", " ) ) ;
@@ -5614,24 +5620,30 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
56145620
56155621 // emit prologue directives prior to __extends
56165622 var startIndex = emitDirectivePrologues ( node . statements , /*startWithNewLine*/ false ) ;
5617- // Only Emit __extends function when target ES5.
5618- // For target ES6 and above, we can emit classDeclaration as is.
5619- if ( ( languageVersion < ScriptTarget . ES6 ) && ( ! extendsEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitExtends ) ) {
5620- writeLines ( extendsHelper ) ;
5621- extendsEmitted = true ;
5622- }
56235623
5624- if ( ! decorateEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitDecorate ) {
5625- writeLines ( decorateHelper ) ;
5626- if ( compilerOptions . emitDecoratorMetadata ) {
5627- writeLines ( metadataHelper ) ;
5624+ // Only emit helpers if the user did not say otherwise.
5625+ if ( ! compilerOptions . noEmitHelpers ) {
5626+
5627+ // Only Emit __extends function when target ES5.
5628+ // For target ES6 and above, we can emit classDeclaration as is.
5629+ if ( ( languageVersion < ScriptTarget . ES6 ) && ( ! extendsEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitExtends ) ) {
5630+ writeLines ( extendsHelper ) ;
5631+ extendsEmitted = true ;
5632+ }
5633+
5634+ if ( ! decorateEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitDecorate ) {
5635+ writeLines ( decorateHelper ) ;
5636+ if ( compilerOptions . emitDecoratorMetadata ) {
5637+ writeLines ( metadataHelper ) ;
5638+ }
5639+ decorateEmitted = true ;
5640+ }
5641+
5642+ if ( ! paramEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitParam ) {
5643+ writeLines ( paramHelper ) ;
5644+ paramEmitted = true ;
56285645 }
5629- decorateEmitted = true ;
5630- }
56315646
5632- if ( ! paramEmitted && resolver . getNodeCheckFlags ( node ) & NodeCheckFlags . EmitParam ) {
5633- writeLines ( paramHelper ) ;
5634- paramEmitted = true ;
56355647 }
56365648
56375649 if ( isExternalModule ( node ) || compilerOptions . separateCompilation ) {
0 commit comments