File tree Expand file tree Collapse file tree 3 files changed +63
-1
lines changed Expand file tree Collapse file tree 3 files changed +63
-1
lines changed Original file line number Diff line number Diff line change 1
- Copyright 2017 Atlassian Pty Ltd
1
+ Copyright 2017 - present Atlassian Pty Ltd
2
2
3
3
Licensed under the Apache License, Version 2.0 (the "License");
4
4
you may not use this file except in compliance with the License.
Original file line number Diff line number Diff line change 1
1
# extract-react-types
2
2
3
3
> Extract Flow & TypeScript types from React Components
4
+
5
+ ## Features
6
+
7
+ - Supports flow and typescript
8
+ - Extracts the description of the props too ( Great for documentation )
9
+
10
+ ## Usage
11
+
12
+ ``` sh
13
+ $ yarn add extract-react-types
14
+ ```
15
+
16
+ ``` js
17
+ // Component.js
18
+
19
+ class Component extends React .Component < { foo: boolean }> {}
20
+ ```
21
+
22
+ Output:
23
+
24
+ ``` js
25
+ {
26
+ " kind" : " program" ,
27
+ " classes" : [
28
+ {
29
+ " kind" : " object" ,
30
+ " members" : [
31
+ {
32
+ " kind" : " property" ,
33
+ " key" : {
34
+ " kind" : " id" ,
35
+ " name" : " foo"
36
+ },
37
+ " value" : {
38
+ " kind" : " boolean"
39
+ },
40
+ " optional" : false
41
+ }
42
+ ],
43
+ " name" : {
44
+ " kind" : " id" ,
45
+ " name" : " Component" ,
46
+ " type" : null
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ ## Related projects:
54
+
55
+ - [ extract-react-types-loader] ( https://www.npmjs.com/package/extract-react-types-loader )
56
+ - [ pretty-proptypes] ( https://github.com/Noviny/pretty-proptypes )
57
+ - [ kind2string] ( https://github.com/gwyneplaine/kind2string )
58
+
Original file line number Diff line number Diff line change 8
8
"scripts" : {
9
9
"test" : " jest"
10
10
},
11
+ "keywords" : [
12
+ " react" ,
13
+ " flow" ,
14
+ " typescript" ,
15
+ " prop-types" ,
16
+ " documentation"
17
+ ],
11
18
"dependencies" : {
12
19
"@babel/core" : " 7.0.0-beta.56" ,
13
20
"@babel/types" : " ^7.0.0-beta.56" ,
You can’t perform that action at this time.
0 commit comments