Skip to content

Commit 7530a2b

Browse files
committed
Merge branch 'master' of github.com:documentationjs/documentation
2 parents 1409aeb + 2c2087d commit 7530a2b

7 files changed

+1010
-2
lines changed

lib/flow_doctrine.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,13 @@ function flowDoctrine(type/*: Object */)/*: DoctrineType*/ {
9898
return {
9999
type: 'FunctionType',
100100
params: type.params.map(param => {
101+
let name = '';
102+
if (param.name && param.name.name) {
103+
name = param.name.name;
104+
}
101105
return {
102106
type: 'ParameterType',
103-
name: param.name.name,
107+
name,
104108
expression: flowDoctrine(param.typeAnnotation)
105109
};
106110
}),

lib/output/util/format_type.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,10 @@ function formatType(getHref/*: Function*/, node/*: ?Object */) {
118118
case Syntax.NameExpression:
119119
return [link(node.name, getHref)];
120120
case Syntax.ParameterType:
121-
return [t(node.name + ': ')].concat(formatType(getHref, node.expression));
121+
if (node.name) {
122+
result.push(t(node.name + ': '));
123+
}
124+
return result.concat(formatType(getHref, node.expression));
122125

123126
case Syntax.TypeApplication:
124127
return formatType(getHref, node.expression)
+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// @flow
2+
3+
'use strict';
4+
5+
/** x */
6+
let x: T => string;
7+
8+
/** x2 */
9+
let x2: (a: T) => string;
10+
11+
/** T */
12+
type T = string[] => {num: number};
13+
14+
/** T2 */
15+
type T2 = (a: string[]) => {num: number};

0 commit comments

Comments
 (0)