typescript: make code compatible with typescript 2.4
Summary:
Forward-declare a type found in TypeScript 2.4 to make this
code work both in TS2.3 and TS2.4.
Reviewers: #core_team, fromberger
Subscribers: #core_team
@@ -21,6 +21,14 @@ import * as ts from 'typescript';
import * as utf8 from './utf8';
+// Forward-declare a type found in TypeScript 2.4 to make this
+// code work both in TS2.3 and TS2.4.
+declare module 'typescript' {
+ interface NamedDeclaration extends Declaration {
+ name?: DeclarationName;
+ }
+}
+
/** VName is the type of Kythe node identities. */
export interface VName {
signature: string;
@@ -255,7 +263,7 @@ class Vistor {
case ts.SyntaxKind.TypeAliasDeclaration:
case ts.SyntaxKind.TypeParameter:
case ts.SyntaxKind.VariableDeclaration:
- let decl = node as ts.Declaration;
+ const decl = node as ts.NamedDeclaration;
if (decl.name && decl.name.kind === ts.SyntaxKind.Identifier) {
parts.push(decl.name.text);
} else {
