Skip to content

Commit ade60be

Browse files
committed
Update to ast-types 0.8.18
... to include `TypeParameter` information (d5ce0400511bdf6b063c13728c4fa09edd9e122d). See also flow/flow-codemod#6 (comment) .
1 parent 2ad8a66 commit ade60be

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

lib/printer.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,6 +1424,28 @@ function genericPrintNoParens(path, options, print) {
14241424
fromString(", ").join(path.map(print, "params")),
14251425
">"
14261426
]);
1427+
case "TypeParameter":
1428+
switch (n.variance) {
1429+
case 'plus':
1430+
parts.push('+');
1431+
break;
1432+
case 'minus':
1433+
parts.push('-');
1434+
break;
1435+
default:
1436+
}
1437+
1438+
parts.push(path.call(print, 'name'));
1439+
1440+
if (n.bound) {
1441+
parts.push(path.call(print, 'bound'));
1442+
}
1443+
1444+
if (n['default']) {
1445+
parts.push('=', path.call(print, 'default'));
1446+
}
1447+
1448+
return concat(parts);
14271449

14281450
case "TypeofTypeAnnotation":
14291451
return concat([
@@ -1437,6 +1459,9 @@ function genericPrintNoParens(path, options, print) {
14371459
case "VoidTypeAnnotation":
14381460
return fromString("void", options);
14391461

1462+
case "NullTypeAnnotation":
1463+
return fromString("null", options);
1464+
14401465
// Unhandled types below. If encountered, nodes of these types should
14411466
// be either left alone or desugared into AST types that are fully
14421467
// supported by the pretty-printer.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"fs": false
2929
},
3030
"dependencies": {
31-
"ast-types": "0.8.17",
31+
"ast-types": "0.8.18",
3232
"esprima": "~2.7.1",
3333
"private": "~0.1.5",
3434
"source-map": "~0.5.0"

0 commit comments

Comments
 (0)