diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index edb51cc59da..932677b526a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -17738,7 +17738,7 @@ namespace ts { } if (node.kind === SyntaxKind.BindingElement) { - if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext && !isInAmbientContext(node)) { + if (node.parent.kind === SyntaxKind.ObjectBindingPattern && languageVersion < ScriptTarget.ESNext) { checkExternalEmitHelpers(node, ExternalEmitHelpers.Rest); } // check computed properties inside property names of binding elements @@ -18758,7 +18758,7 @@ namespace ts { const baseTypeNode = getClassExtendsHeritageClauseElement(node); if (baseTypeNode) { - if (languageVersion < ScriptTarget.ES2015 && !isInAmbientContext(node)) { + if (languageVersion < ScriptTarget.ES2015) { checkExternalEmitHelpers(baseTypeNode.parent, ExternalEmitHelpers.Extends); } @@ -21287,7 +21287,7 @@ namespace ts { function checkExternalEmitHelpers(location: Node, helpers: ExternalEmitHelpers) { if ((requestedExternalEmitHelpers & helpers) !== helpers && compilerOptions.importHelpers) { const sourceFile = getSourceFileOfNode(location); - if (!isDeclarationFile(sourceFile) && isEffectiveExternalModule(sourceFile, compilerOptions)) { + if (isEffectiveExternalModule(sourceFile, compilerOptions) && !isInAmbientContext(location)) { const helpersModule = resolveHelpersModule(sourceFile, location); if (helpersModule !== unknownSymbol) { const uncheckedHelpers = helpers & ~requestedExternalEmitHelpers; diff --git a/src/compiler/comments.ts b/src/compiler/comments.ts index f252bfa5c5d..dcb471dcfcc 100644 --- a/src/compiler/comments.ts +++ b/src/compiler/comments.ts @@ -272,7 +272,7 @@ namespace ts { function forEachLeadingCommentToEmit(pos: number, cb: (commentPos: number, commentEnd: number, kind: SyntaxKind, hasTrailingNewLine: boolean, rangePos: number) => void) { // Emit the leading comments only if the container's pos doesn't match because the container should take care of emitting these comments - if ((containerPos === -1 || pos !== containerPos)) { + if (containerPos === -1 || pos !== containerPos) { if (hasDetachedComments(pos)) { forEachLeadingCommentWithoutDetachedComments(cb); } @@ -284,7 +284,7 @@ namespace ts { function forEachTrailingCommentToEmit(end: number, cb: (commentPos: number, commentEnd: number, kind: SyntaxKind, hasTrailingNewLine: boolean) => void) { // Emit the trailing comments only if the container's end doesn't match because the container should take care of emitting these comments - if ((containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd))) { + if (containerEnd === -1 || (end !== containerEnd && end !== declarationListContainerEnd)) { forEachTrailingCommentRange(currentText, end, cb); } }