Skip to content

Commit 3059cdf

Browse files
committed
Add JSDoc tests
1 parent 13b3bc5 commit 3059cdf

File tree

2 files changed

+79
-0
lines changed

2 files changed

+79
-0
lines changed

test/jsdocs/input.tsx

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import * as React from 'react';
2+
3+
/**
4+
* The test component.
5+
*
6+
* @internal
7+
*/
8+
function Component(props: Props): React.ReactElement {
9+
return <div {...props} />;
10+
}
11+
12+
interface Props {
13+
/**
14+
* The class name.
15+
* Used to make the component more classy.
16+
*/
17+
className?: string;
18+
/**
19+
* A value.
20+
*
21+
* @default 10
22+
*/
23+
someValue?: number;
24+
}

test/jsdocs/output.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"type": "ProgramNode",
3+
"body": [
4+
{
5+
"type": "ComponentNode",
6+
"name": "Component",
7+
"types": [
8+
{
9+
"type": "PropNode",
10+
"name": "className",
11+
"jsDoc": "The class name.\nUsed to make the component more classy.",
12+
"propType": {
13+
"type": "UnionNode",
14+
"types": [
15+
{
16+
"type": "SimpleTypeNode",
17+
"typeName": "undefined"
18+
},
19+
{
20+
"type": "SimpleTypeNode",
21+
"typeName": "string"
22+
}
23+
]
24+
},
25+
"optional": true,
26+
"filenames": {}
27+
},
28+
{
29+
"type": "PropNode",
30+
"name": "disabled",
31+
"jsDoc": "Whether the component is disabled.",
32+
"propType": {
33+
"type": "UnionNode",
34+
"types": [
35+
{
36+
"type": "SimpleTypeNode",
37+
"typeName": "undefined"
38+
},
39+
{
40+
"type": "LiteralNode",
41+
"value": "false"
42+
},
43+
{
44+
"type": "LiteralNode",
45+
"value": "true"
46+
}
47+
]
48+
},
49+
"optional": true,
50+
"filenames": {}
51+
}
52+
]
53+
}
54+
]
55+
}

0 commit comments

Comments
 (0)