From a523f60209fbc1b934bae0e56b96163ce1167723 Mon Sep 17 00:00:00 2001 From: Sebastian McKenzie Date: Mon, 20 Jul 2015 00:20:40 +0100 Subject: [PATCH] output type annotations of type instantiation parameters - fixes #2036 --- packages/babel/src/generation/generators/flow.js | 7 ++++++- .../fixtures/generation/flow/type-annotations/actual.js | 1 + .../fixtures/generation/flow/type-annotations/expected.js | 1 + 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/babel/src/generation/generators/flow.js b/packages/babel/src/generation/generators/flow.js index 5c061ce9a6..382105102b 100644 --- a/packages/babel/src/generation/generators/flow.js +++ b/packages/babel/src/generation/generators/flow.js @@ -252,7 +252,12 @@ export function TypeAnnotation(node, print) { export function TypeParameterInstantiation(node, print) { this.push("<"); - print.join(node.params, { separator: ", " }); + print.join(node.params, { + separator: ", ", + iterator(node) { + print.plain(node.typeAnnotation); + } + }); this.push(">"); } diff --git a/packages/babel/test/fixtures/generation/flow/type-annotations/actual.js b/packages/babel/test/fixtures/generation/flow/type-annotations/actual.js index 8faee26e1d..ec99a435d4 100644 --- a/packages/babel/test/fixtures/generation/flow/type-annotations/actual.js +++ b/packages/babel/test/fixtures/generation/flow/type-annotations/actual.js @@ -16,6 +16,7 @@ function foo():(_?:bool) => number{} function foo(): {} {} function foo() {} function foo() {} +function foo() {} a = function() {}; a = { set fooProp(value: number) {} }; a = { set fooProp(value: number): void {} }; diff --git a/packages/babel/test/fixtures/generation/flow/type-annotations/expected.js b/packages/babel/test/fixtures/generation/flow/type-annotations/expected.js index ffd122ae4d..bfbd4a805f 100644 --- a/packages/babel/test/fixtures/generation/flow/type-annotations/expected.js +++ b/packages/babel/test/fixtures/generation/flow/type-annotations/expected.js @@ -16,6 +16,7 @@ function foo(): (_?: bool) => number {} function foo(): {} {} function foo() {} function foo() {} +function foo() {} a = function () {}; a = { set fooProp(value: number) {} }; a = { set fooProp(value: number): void {} };