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

Commit e76f3b9

Browse files
JamesHenrynzakas
authored andcommitted
New: Convert type alias into variable declaration (refs #77) (#83)
1 parent 5c47ad5 commit e76f3b9

File tree

3 files changed

+475
-0
lines changed

3 files changed

+475
-0
lines changed

lib/ast-converter.js

+13
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,19 @@ module.exports = function(ast, extra) {
17871787
case SyntaxKind.ParenthesizedExpression:
17881788
return convert(node.expression, parent);
17891789

1790+
/**
1791+
* Convert TypeAliasDeclaration node into VariableDeclaration
1792+
* to allow core rules such as "semi" to work automatically
1793+
*/
1794+
case SyntaxKind.TypeAliasDeclaration:
1795+
deeplyCopy();
1796+
assign(result, {
1797+
type: "VariableDeclaration",
1798+
kind: "type",
1799+
declarations: []
1800+
});
1801+
break;
1802+
17901803
default:
17911804
deeplyCopy();
17921805
}

0 commit comments

Comments
 (0)