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

Commit e36d800

Browse files
JamesHenrynzakas
authored andcommitted
Fix: Convert TypeAliasDeclaration into VariableDeclarator (fixes #89) (#91)
1 parent ac0c95d commit e36d800

File tree

2 files changed

+176
-183
lines changed

2 files changed

+176
-183
lines changed

lib/ast-converter.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -1839,11 +1839,19 @@ module.exports = function(ast, extra) {
18391839
* to allow core rules such as "semi" to work automatically
18401840
*/
18411841
case SyntaxKind.TypeAliasDeclaration:
1842-
deeplyCopy();
1842+
var typeAliasDeclarator = {
1843+
type: "VariableDeclarator",
1844+
id: convertChild(node.name),
1845+
init: convertChild(node.type)
1846+
};
1847+
// Process typeParameters
1848+
if (node.typeParameters && node.typeParameters.length) {
1849+
typeAliasDeclarator.typeParameters = convertTSTypeParametersToTypeParametersDeclaration(node.typeParameters);
1850+
}
18431851
assign(result, {
18441852
type: "VariableDeclaration",
18451853
kind: "type",
1846-
declarations: []
1854+
declarations: [typeAliasDeclarator]
18471855
});
18481856
break;
18491857

0 commit comments

Comments
 (0)