documentation/test/fixture/flow-types.output.json
Tom MacWright 70cc7d0718 Infer Flow type aliases into typedefs. Fixes #227
Given the `type` tag introduced with Flow, this can infer
a typedef statement, as well as infer its potentially
nested properties and their types.

This also includes

* Refactor of Markdown AST generation that fixes #228
* Refactor of nest.js to handle multi-level nesting
2015-11-04 11:25:32 -05:00

329 lines
8.3 KiB
JSON

[
{
"description": "A 2D point.",
"tags": [
{
"title": "property",
"description": "this is a prop",
"lineNumber": 3,
"type": {
"type": "NameExpression",
"name": "number"
},
"name": "x"
}
],
"loc": {
"start": {
"line": 8,
"column": 0
},
"end": {
"line": 12,
"column": 3
}
},
"context": {
"loc": {
"start": {
"line": 13,
"column": 0
},
"end": {
"line": 24,
"column": 2
}
},
"code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array<number>, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array<string>;\n"
},
"errors": [],
"properties": [
{
"title": "property",
"description": "this is a prop",
"lineNumber": 3,
"type": {
"type": "NameExpression",
"name": "number"
},
"name": "x"
},
{
"title": "property",
"name": "y",
"lineNumber": 15,
"type": {
"type": "NameExpression",
"name": "number"
}
},
{
"title": "property",
"name": "rgb",
"lineNumber": 16,
"type": {
"type": "NameExpression",
"name": "Object"
},
"properties": [
{
"title": "property",
"name": "rgb.hex",
"lineNumber": 17,
"type": {
"type": "NameExpression",
"name": "string"
}
}
]
},
{
"title": "property",
"name": "props",
"lineNumber": 19,
"type": {
"type": "NameExpression",
"name": "Object"
},
"properties": [
{
"title": "property",
"name": "props.radius",
"lineNumber": 20,
"type": {
"type": "NameExpression",
"name": "Object"
},
"properties": [
{
"title": "property",
"name": "props.radius.x",
"lineNumber": 21,
"type": {
"type": "NameExpression",
"name": "number"
}
}
]
}
]
}
],
"name": "Point",
"kind": "typedef",
"members": {
"instance": [],
"static": []
},
"path": [
"Point"
]
},
{
"description": "Just an alias for an array of strings",
"tags": [],
"loc": {
"start": {
"line": 34,
"column": 0
},
"end": {
"line": 36,
"column": 3
}
},
"context": {
"loc": {
"start": {
"line": 37,
"column": 0
},
"end": {
"line": 37,
"column": 23
}
},
"code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array<number>, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array<string>;\n"
},
"errors": [],
"name": "T",
"kind": "typedef",
"members": {
"instance": [],
"static": []
},
"path": [
"T"
]
},
{
"description": "A type with entirely derived properties",
"tags": [],
"loc": {
"start": {
"line": 26,
"column": 0
},
"end": {
"line": 28,
"column": 3
}
},
"context": {
"loc": {
"start": {
"line": 29,
"column": 0
},
"end": {
"line": 32,
"column": 2
}
},
"code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array<number>, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array<string>;\n"
},
"errors": [],
"name": "Two",
"kind": "typedef",
"properties": [
{
"title": "property",
"name": "x",
"lineNumber": 30,
"type": {
"type": "NameExpression",
"name": "number"
}
},
{
"title": "property",
"name": "y",
"lineNumber": 31,
"type": {
"type": "NameExpression",
"name": "number"
}
}
],
"members": {
"instance": [],
"static": []
},
"path": [
"Two"
]
},
{
"description": "This function returns the number one.",
"tags": [],
"loc": {
"start": {
"line": 1,
"column": 0
},
"end": {
"line": 3,
"column": 3
}
},
"context": {
"loc": {
"start": {
"line": 4,
"column": 0
},
"end": {
"line": 6,
"column": 1
}
},
"code": "/**\n * This function returns the number one.\n */\nfunction addThem(a: Point, b: string, c: ?boolean, d: Array<number>, e: Object, f: Named): number {\n return a + b + c + d + e;\n}\n\n/**\n * A 2D point.\n *\n * @property {number} x this is a prop\n */\ntype Point = {\n x: number,\n y: number,\n rgb: {\n hex: string\n },\n props: {\n radius: {\n x: number\n }\n }\n};\n\n/**\n * A type with entirely derived properties\n */\ntype Two = {\n x: number,\n y: number\n};\n\n/**\n * Just an alias for an array of strings\n */\ntype T = Array<string>;\n"
},
"errors": [],
"name": "addThem",
"kind": "function",
"params": [
{
"title": "param",
"name": "a",
"lineNumber": 4,
"type": {
"type": "NameExpression",
"name": "Point"
}
},
{
"title": "param",
"name": "b",
"lineNumber": 4,
"type": {
"type": "NameExpression",
"name": "string"
}
},
{
"title": "param",
"name": "c",
"lineNumber": 4,
"type": {
"type": "OptionalType",
"expression": {
"type": "NameExpression",
"name": "boolean"
}
}
},
{
"title": "param",
"name": "d",
"lineNumber": 4,
"type": {
"type": "TypeApplication",
"expression": {
"type": "NameExpression",
"name": "Array"
},
"applications": [
{
"type": "NameExpression",
"name": "number"
}
]
}
},
{
"title": "param",
"name": "e",
"lineNumber": 4,
"type": {
"type": "NameExpression",
"name": "Object"
}
},
{
"title": "param",
"name": "f",
"lineNumber": 4,
"type": {
"type": "NameExpression",
"name": "Named"
}
}
],
"returns": [
{
"type": {
"type": "NameExpression",
"name": "number"
}
}
],
"members": {
"instance": [],
"static": []
},
"path": [
"addThem"
]
}
]