Fix crash on non-dts-require (#19980)

This commit is contained in:
Wesley Wigham
2017-11-13 16:41:29 -08:00
committed by GitHub
parent 3d602936e0
commit 7d93434f2c
5 changed files with 59 additions and 1 deletions

View File

@@ -17179,7 +17179,7 @@ namespace ts {
if (targetDeclarationKind !== SyntaxKind.Unknown) {
const decl = getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
// function/variable declaration should be ambient
return !!(decl.flags & NodeFlags.Ambient);
return !!decl && !!(decl.flags & NodeFlags.Ambient);
}
return false;
}