Skip to content

Commit

Permalink
Update to ast-types 0.8.18
Browse files Browse the repository at this point in the history
... to include `TypeParameter` information (d5ce0400511bdf6b063c13728c4fa09edd9e122d). See also flow/flow-codemod#6 (comment) .
  • Loading branch information
fkling committed Jul 20, 2016
1 parent 2ad8a66 commit ade60be
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
25 changes: 25 additions & 0 deletions lib/printer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1424,6 +1424,28 @@ function genericPrintNoParens(path, options, print) {
fromString(", ").join(path.map(print, "params")),
">"
]);
case "TypeParameter":
switch (n.variance) {
case 'plus':
parts.push('+');
break;
case 'minus':
parts.push('-');
break;
default:
}

parts.push(path.call(print, 'name'));

if (n.bound) {
parts.push(path.call(print, 'bound'));
}

if (n['default']) {
parts.push('=', path.call(print, 'default'));
}

return concat(parts);

case "TypeofTypeAnnotation":
return concat([
Expand All @@ -1437,6 +1459,9 @@ function genericPrintNoParens(path, options, print) {
case "VoidTypeAnnotation":
return fromString("void", options);

case "NullTypeAnnotation":
return fromString("null", options);

// Unhandled types below. If encountered, nodes of these types should
// be either left alone or desugared into AST types that are fully
// supported by the pretty-printer.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"fs": false
},
"dependencies": {
"ast-types": "0.8.17",
"ast-types": "0.8.18",
"esprima": "~2.7.1",
"private": "~0.1.5",
"source-map": "~0.5.0"
Expand Down

0 comments on commit ade60be

Please sign in to comment.