Skip to content

Fix(flow): Allow unnamed parameters #674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/flow_doctrine.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ function flowDoctrine(type/*: Object */)/*: DoctrineType*/ {
params: type.params.map(param => {
let name = '';
if (param.name && param.name.name) {
name = param.name.name;
name = param.name.name;
}
return {
type: 'ParameterType',
name: name,
name,
expression: flowDoctrine(param.typeAnnotation)
};
}),
Expand Down
2 changes: 1 addition & 1 deletion lib/output/util/format_type.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function formatType(getHref/*: Function*/, node/*: ?Object */) {
return [link(node.name, getHref)];
case Syntax.ParameterType:
if (node.name) {
result.push(t(node.name + ': '));
result.push(t(node.name + ': '));
}
return result.concat(formatType(getHref, node.expression));

Expand Down
15 changes: 15 additions & 0 deletions test/fixture/flow-unnamed-params.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// @flow

'use strict';

/** x */
let x: T => string;

/** x2 */
let x2: (a: T) => string;

/** T */
type T = string[] => {num: number};

/** T2 */
type T2 = (a: string[]) => {num: number};
Loading