Skip to content
This repository was archived by the owner on Jan 19, 2019. It is now read-only.

Commit 7b8072c

Browse files
committed
Fix: Use ts utilities determine variable declaration type (fixes #136)
This fixes an issue where async functions will mark all variable declarations as constant. We change the way node flags are read by using ts utilities functions (isLet and isConst)
1 parent 2df6d83 commit 7b8072c

File tree

3 files changed

+707
-2
lines changed

3 files changed

+707
-2
lines changed

lib/ast-converter.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -899,8 +899,10 @@ module.exports = function(ast, extra) {
899899

900900
var varStatementKind;
901901

902-
if (node.declarationList.flags) {
903-
varStatementKind = (node.declarationList.flags === ts.NodeFlags.Let) ? "let" : "const";
902+
if (ts.isLet(node.declarationList)) {
903+
varStatementKind = "let";
904+
} else if (ts.isConst(node.declarationList)) {
905+
varStatementKind = "const";
904906
} else {
905907
varStatementKind = "var";
906908
}

0 commit comments

Comments
 (0)