diff --git a/lib/printer.js b/lib/printer.js index 8a18e8c5..9dc9371f 100644 --- a/lib/printer.js +++ b/lib/printer.js @@ -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([ @@ -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. diff --git a/package.json b/package.json index 0ea4b81b..d434286c 100644 --- a/package.json +++ b/package.json @@ -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"