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

Commit 11d5a7d

Browse files
soda0289nzakas
authored andcommitted
Fix: Handle object types without annotations (fixes #148) (#154)
Typescript allows object/interface type definitions without type annotations. This commit will replace missing type annotations with null instead of trying to convert them.
1 parent fc1e6bb commit 11d5a7d

7 files changed

+1306
-1
lines changed

lib/ast-converter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ module.exports = function(ast, extra) {
659659
return !(/^(?:kind|parent|pos|end|flags)$/.test(key));
660660
}).forEach(function(key) {
661661
if (key === "type") {
662-
result.typeAnnotation = convertTypeAnnotation(node.type);
662+
result.typeAnnotation = (node.type) ? convertTypeAnnotation(node.type) : null;
663663
} else {
664664
if (Array.isArray(node[key])) {
665665
result[key] = node[key].map(convertChild);

0 commit comments

Comments
 (0)