@@ -125,30 +125,6 @@ function findFirstMatchingChild(node, sourceFile, predicate) {
125125 return undefined ;
126126}
127127
128- /**
129- * Returns true if the given TSNode is a let variable declaration
130- * @param {TSNode } node The TSNode
131- * @returns {boolean } whether or not the given node is a let variable declaration
132- */
133- function isLet ( node ) {
134- /**
135- * TODO: Remove dependency on private TypeScript method
136- */
137- return ts . isLet ( node ) ;
138- }
139-
140- /**
141- * Returns true if the given TSNode is a const variable declaration
142- * @param {TSNode } node The TSNode
143- * @returns {boolean } whether or not the given node is a const variable declaration
144- */
145- function isConst ( node ) {
146- /**
147- * TODO: Remove dependency on private TypeScript method
148- */
149- return ts . isConst ( node ) ;
150- }
151-
152128//------------------------------------------------------------------------------
153129// Public
154130//------------------------------------------------------------------------------
@@ -179,7 +155,6 @@ module.exports = {
179155 findFirstMatchingAncestor,
180156 findAncestorOfKind,
181157 hasJSXAncestor,
182- unescapeIdentifier,
183158 unescapeStringLiteralText,
184159 isComputedProperty,
185160 isOptional,
@@ -366,24 +341,20 @@ function isTypeKeyword(kind) {
366341 * @returns {string } declaration kind
367342 */
368343function getDeclarationKind ( node ) {
369- let varDeclarationKind ;
370344 switch ( node . kind ) {
371345 case SyntaxKind . TypeAliasDeclaration :
372- varDeclarationKind = "type" ;
373- break ;
346+ return "type" ;
374347 case SyntaxKind . VariableDeclarationList :
375- if ( isLet ( node ) ) {
376- varDeclarationKind = "let" ;
377- } else if ( isConst ( node ) ) {
378- varDeclarationKind = "const" ;
379- } else {
380- varDeclarationKind = "var" ;
348+ if ( node . flags & ts . NodeFlags . Let ) {
349+ return "let" ;
381350 }
382- break ;
351+ if ( node . flags & ts . NodeFlags . Const ) {
352+ return "const" ;
353+ }
354+ return "var" ;
383355 default :
384356 throw "Unable to determine declaration kind." ;
385357 }
386- return varDeclarationKind ;
387358}
388359
389360/**
@@ -502,15 +473,6 @@ function hasJSXAncestor(node) {
502473 return ! ! findFirstMatchingAncestor ( node , isJSXToken ) ;
503474}
504475
505- /**
506- * Remove extra underscore from escaped identifier text content.
507- * @param {string } identifier The escaped identifier text.
508- * @returns {string } The unescaped identifier text.
509- */
510- function unescapeIdentifier ( identifier ) {
511- return ts . unescapeIdentifier ( identifier ) ;
512- }
513-
514476/**
515477 * Unescape the text content of string literals, e.g. & -> &
516478 * @param {string } text The escaped string literal text.
0 commit comments