mirror of
https://github.com/documentationjs/documentation.git
synced 2026-01-25 14:26:29 +00:00
Merge branch 'master' of github.com:documentationjs/documentation
This commit is contained in:
commit
7530a2baf8
@ -98,9 +98,13 @@ function flowDoctrine(type/*: Object */)/*: DoctrineType*/ {
|
||||
return {
|
||||
type: 'FunctionType',
|
||||
params: type.params.map(param => {
|
||||
let name = '';
|
||||
if (param.name && param.name.name) {
|
||||
name = param.name.name;
|
||||
}
|
||||
return {
|
||||
type: 'ParameterType',
|
||||
name: param.name.name,
|
||||
name,
|
||||
expression: flowDoctrine(param.typeAnnotation)
|
||||
};
|
||||
}),
|
||||
|
||||
@ -118,7 +118,10 @@ function formatType(getHref/*: Function*/, node/*: ?Object */) {
|
||||
case Syntax.NameExpression:
|
||||
return [link(node.name, getHref)];
|
||||
case Syntax.ParameterType:
|
||||
return [t(node.name + ': ')].concat(formatType(getHref, node.expression));
|
||||
if (node.name) {
|
||||
result.push(t(node.name + ': '));
|
||||
}
|
||||
return result.concat(formatType(getHref, node.expression));
|
||||
|
||||
case Syntax.TypeApplication:
|
||||
return formatType(getHref, node.expression)
|
||||
|
||||
15
test/fixture/flow-unnamed-params.input.js
Normal file
15
test/fixture/flow-unnamed-params.input.js
Normal file
@ -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};
|
||||
510
test/fixture/flow-unnamed-params.output.json
Normal file
510
test/fixture/flow-unnamed-params.output.json
Normal file
@ -0,0 +1,510 @@
|
||||
[
|
||||
{
|
||||
"description": {
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 5,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 5,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 6,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 6,
|
||||
"column": 19
|
||||
}
|
||||
}
|
||||
},
|
||||
"augments": [],
|
||||
"errors": [],
|
||||
"examples": [],
|
||||
"params": [],
|
||||
"properties": [],
|
||||
"returns": [],
|
||||
"sees": [],
|
||||
"throws": [],
|
||||
"todos": [],
|
||||
"name": "x",
|
||||
"type": {
|
||||
"type": "FunctionType",
|
||||
"params": [
|
||||
{
|
||||
"type": "ParameterType",
|
||||
"name": "",
|
||||
"expression": {
|
||||
"type": "NameExpression",
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"type": "NameExpression",
|
||||
"name": "string"
|
||||
}
|
||||
},
|
||||
"members": {
|
||||
"global": [],
|
||||
"inner": [],
|
||||
"instance": [],
|
||||
"events": [],
|
||||
"static": []
|
||||
},
|
||||
"path": [
|
||||
{
|
||||
"name": "x"
|
||||
}
|
||||
],
|
||||
"namespace": "x"
|
||||
},
|
||||
{
|
||||
"description": {
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x2",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 8,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 8,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 9,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 9,
|
||||
"column": 25
|
||||
}
|
||||
}
|
||||
},
|
||||
"augments": [],
|
||||
"errors": [],
|
||||
"examples": [],
|
||||
"params": [],
|
||||
"properties": [],
|
||||
"returns": [],
|
||||
"sees": [],
|
||||
"throws": [],
|
||||
"todos": [],
|
||||
"name": "x2",
|
||||
"type": {
|
||||
"type": "FunctionType",
|
||||
"params": [
|
||||
{
|
||||
"type": "ParameterType",
|
||||
"name": "a",
|
||||
"expression": {
|
||||
"type": "NameExpression",
|
||||
"name": "T"
|
||||
}
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"type": "NameExpression",
|
||||
"name": "string"
|
||||
}
|
||||
},
|
||||
"members": {
|
||||
"global": [],
|
||||
"inner": [],
|
||||
"instance": [],
|
||||
"events": [],
|
||||
"static": []
|
||||
},
|
||||
"path": [
|
||||
{
|
||||
"name": "x2"
|
||||
}
|
||||
],
|
||||
"namespace": "x2"
|
||||
},
|
||||
{
|
||||
"description": {
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 11,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 11,
|
||||
"column": 8
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 12,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 12,
|
||||
"column": 35
|
||||
}
|
||||
}
|
||||
},
|
||||
"augments": [],
|
||||
"errors": [],
|
||||
"examples": [],
|
||||
"params": [],
|
||||
"properties": [],
|
||||
"returns": [],
|
||||
"sees": [],
|
||||
"throws": [],
|
||||
"todos": [],
|
||||
"name": "T",
|
||||
"kind": "typedef",
|
||||
"type": {
|
||||
"type": "FunctionType",
|
||||
"params": [
|
||||
{
|
||||
"type": "ParameterType",
|
||||
"name": "",
|
||||
"expression": {
|
||||
"type": "TypeApplication",
|
||||
"expression": {
|
||||
"type": "NameExpression",
|
||||
"name": "Array"
|
||||
},
|
||||
"applications": [
|
||||
{
|
||||
"type": "NameExpression",
|
||||
"name": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"type": "RecordType",
|
||||
"fields": [
|
||||
{
|
||||
"type": "FieldType",
|
||||
"key": "num",
|
||||
"value": {
|
||||
"type": "NameExpression",
|
||||
"name": "number"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"members": {
|
||||
"global": [],
|
||||
"inner": [],
|
||||
"instance": [],
|
||||
"events": [],
|
||||
"static": []
|
||||
},
|
||||
"path": [
|
||||
{
|
||||
"name": "T",
|
||||
"kind": "typedef"
|
||||
}
|
||||
],
|
||||
"namespace": "T"
|
||||
},
|
||||
{
|
||||
"description": {
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T2",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
}
|
||||
}
|
||||
},
|
||||
"tags": [],
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 14,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 14,
|
||||
"column": 9
|
||||
}
|
||||
},
|
||||
"context": {
|
||||
"loc": {
|
||||
"start": {
|
||||
"line": 15,
|
||||
"column": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 15,
|
||||
"column": 41
|
||||
}
|
||||
}
|
||||
},
|
||||
"augments": [],
|
||||
"errors": [],
|
||||
"examples": [],
|
||||
"params": [],
|
||||
"properties": [],
|
||||
"returns": [],
|
||||
"sees": [],
|
||||
"throws": [],
|
||||
"todos": [],
|
||||
"name": "T2",
|
||||
"kind": "typedef",
|
||||
"type": {
|
||||
"type": "FunctionType",
|
||||
"params": [
|
||||
{
|
||||
"type": "ParameterType",
|
||||
"name": "a",
|
||||
"expression": {
|
||||
"type": "TypeApplication",
|
||||
"expression": {
|
||||
"type": "NameExpression",
|
||||
"name": "Array"
|
||||
},
|
||||
"applications": [
|
||||
{
|
||||
"type": "NameExpression",
|
||||
"name": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"result": {
|
||||
"type": "RecordType",
|
||||
"fields": [
|
||||
{
|
||||
"type": "FieldType",
|
||||
"key": "num",
|
||||
"value": {
|
||||
"type": "NameExpression",
|
||||
"name": "number"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"members": {
|
||||
"global": [],
|
||||
"inner": [],
|
||||
"instance": [],
|
||||
"events": [],
|
||||
"static": []
|
||||
},
|
||||
"path": [
|
||||
{
|
||||
"name": "T2",
|
||||
"kind": "typedef"
|
||||
}
|
||||
],
|
||||
"namespace": "T2"
|
||||
}
|
||||
]
|
||||
32
test/fixture/flow-unnamed-params.output.md
Normal file
32
test/fixture/flow-unnamed-params.output.md
Normal file
@ -0,0 +1,32 @@
|
||||
<!-- Generated by documentation.js. Update this documentation by updating the source code. -->
|
||||
|
||||
### Table of Contents
|
||||
|
||||
- [x](#x)
|
||||
- [x2](#x2)
|
||||
- [T](#t)
|
||||
- [T2](#t2)
|
||||
|
||||
## x
|
||||
|
||||
x
|
||||
|
||||
Type: function ([T](#t)): [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
|
||||
|
||||
## x2
|
||||
|
||||
x2
|
||||
|
||||
Type: function (a: [T](#t)): [string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)
|
||||
|
||||
## T
|
||||
|
||||
T
|
||||
|
||||
Type: function ([Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>): {num: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)}
|
||||
|
||||
## T2
|
||||
|
||||
T2
|
||||
|
||||
Type: function (a: [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)>): {num: [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)}
|
||||
431
test/fixture/flow-unnamed-params.output.md.json
Normal file
431
test/fixture/flow-unnamed-params.output.md.json
Normal file
@ -0,0 +1,431 @@
|
||||
{
|
||||
"type": "root",
|
||||
"children": [
|
||||
{
|
||||
"type": "html",
|
||||
"value": "<!-- Generated by documentation.js. Update this documentation by updating the source code. -->"
|
||||
},
|
||||
{
|
||||
"depth": 2,
|
||||
"type": "heading",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Type: "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "function ("
|
||||
},
|
||||
{
|
||||
"href": "#t",
|
||||
"url": "#t",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ")"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ": "
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"depth": 2,
|
||||
"type": "heading",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "x2",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Type: "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "function ("
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "a: "
|
||||
},
|
||||
{
|
||||
"href": "#t",
|
||||
"url": "#t",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ")"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ": "
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"depth": 2,
|
||||
"type": "heading",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 2,
|
||||
"offset": 1
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Type: "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "function ("
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Array"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "<"
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ">"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ")"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ": "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "num: "
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"depth": 2,
|
||||
"type": "heading",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "T2",
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
}
|
||||
],
|
||||
"position": {
|
||||
"start": {
|
||||
"line": 1,
|
||||
"column": 1,
|
||||
"offset": 0
|
||||
},
|
||||
"end": {
|
||||
"line": 1,
|
||||
"column": 3,
|
||||
"offset": 2
|
||||
},
|
||||
"indent": []
|
||||
}
|
||||
},
|
||||
{
|
||||
"type": "paragraph",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Type: "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "function ("
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "a: "
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "Array"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "<"
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ">"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ")"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": ": "
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "{"
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "num: "
|
||||
},
|
||||
{
|
||||
"href": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
||||
"url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number",
|
||||
"type": "link",
|
||||
"children": [
|
||||
{
|
||||
"type": "text",
|
||||
"value": "number"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "text",
|
||||
"value": "}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -181,6 +181,19 @@ test('flowDoctrine', function (t) {
|
||||
name: 'boolean'
|
||||
}, 'boolean');
|
||||
|
||||
t.deepEqual(toDoctrineType('any => any'),
|
||||
{
|
||||
type: 'FunctionType',
|
||||
params: [
|
||||
{
|
||||
expression: {type: 'AllLiteral'},
|
||||
name: '',
|
||||
type: 'ParameterType'
|
||||
}
|
||||
],
|
||||
result: {type: 'AllLiteral'},
|
||||
}, '');
|
||||
|
||||
t.deepEqual(toDoctrineType('undefined'),
|
||||
{
|
||||
type: 'NameExpression',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user