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

Fix: Convert type guards (fixes #282) #283

Merged
merged 1 commit into from
May 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ast-node-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ module.exports = {
TSQuestionToken: "TSQuestionToken",
TSStringKeyword: "TSStringKeyword",
TSTypeLiteral: "TSTypeLiteral",
TSTypePredicate: "TSTypePredicate",
TSTypeReference: "TSTypeReference",
TSUnionType: "TSUnionType",
TSVoidKeyword: "TSVoidKeyword",
Expand Down
8 changes: 8 additions & 0 deletions lib/convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,14 @@ module.exports = function convert(config) {

}

case SyntaxKind.FirstTypeNode:
Object.assign(result, {
type: AST_NODE_TYPES.TSTypePredicate,
parameterName: convertChild(node.parameterName),
typeAnnotation: convertTypeAnnotation(node.type)
});
break;

default:
deeplyCopy();
}
Expand Down