diff --git a/packages/babel-generator/src/generators/types.js b/packages/babel-generator/src/generators/types.js index aed1c3f35c..5eb8e1148d 100644 --- a/packages/babel-generator/src/generators/types.js +++ b/packages/babel-generator/src/generators/types.js @@ -4,6 +4,18 @@ import * as t from "babel-types"; export function Identifier(node: Object) { + // FIXME: We hang variance off Identifer to support Flow's def-site variance. + // This is a terrible hack, but changing type annotations to use a new, + // dedicated node would be a breaking change. This should be cleaned up in + // the next major. + if (node.variance) { + if (node.variance === "plus") { + this.push("+"); + } else if (node.variance === "minus") { + this.push("-"); + } + } + this.push(node.name); }