Fix cast: location may be a SourceFile (#24498)

This commit is contained in:
Andy
2018-05-30 13:37:32 -07:00
committed by GitHub
parent cead8667b2
commit 239dde8ff1

View File

@@ -1291,7 +1291,7 @@ namespace ts {
isInExternalModule = true;
// falls through
case SyntaxKind.ModuleDeclaration:
const moduleExports = getSymbolOfNode(location as ModuleDeclaration).exports!;
const moduleExports = getSymbolOfNode(location as SourceFile | ModuleDeclaration).exports!;
if (location.kind === SyntaxKind.SourceFile || isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local