Error while computing semantic tokens. Fixes #88366

This commit is contained in:
Martin Aeschlimann
2020-01-09 15:25:57 +01:00
parent 60f27207df
commit db581614ab

View File

@@ -20,7 +20,7 @@ export function getSemanticTokens(jsLanguageService: ts.LanguageService, current
if (node.kind === ts.SyntaxKind.Identifier) { if (node.kind === ts.SyntaxKind.Identifier) {
const symbol = typeChecker.getSymbolAtLocation(node); const symbol = typeChecker.getSymbolAtLocation(node);
if (symbol) { if (symbol) {
const decl = symbol.valueDeclaration || symbol.declarations[0]; const decl = symbol.valueDeclaration || symbol.declarations && symbol.declarations[0];
if (decl) { if (decl) {
let typeIdx = tokenFromDeclarationMapping[decl.kind]; let typeIdx = tokenFromDeclarationMapping[decl.kind];
let modifierSet = 0; let modifierSet = 0;