From 246610957772c8801457ec9c8f32b0686edc0716 Mon Sep 17 00:00:00 2001 From: Andrew Branch Date: Wed, 17 Jul 2019 13:07:10 -0700 Subject: [PATCH] Fix build/lint due to differences in master and LKG (#32450) --- src/compiler/emitter.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index a1207c9b892..8681a452e2a 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -411,7 +411,11 @@ namespace ts { } ); if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === SyntaxKind.SourceFile) { - const sourceFile = declarationTransform.transformed[0] as SourceFile; + // Improved narrowing in master/3.6 makes this cast unnecessary, triggering a lint rule. + // But at the same time, the LKG (3.5) necessitates it because it doesn’t narrow. + // Once the LKG is updated to 3.6, this comment, the cast to `SourceFile`, and the + // tslint directive can be all be removed. + const sourceFile = declarationTransform.transformed[0] as SourceFile; // tslint:disable-line exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit; } }