Skip to content

Commit 63fc21e

Browse files
committed
Merge branch 'master' of github.com:atlassian/extract-react-types
2 parents bb9b66a + c475b1d commit 63fc21e

File tree

3 files changed

+63
-1
lines changed

3 files changed

+63
-1
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2017 Atlassian Pty Ltd
1+
Copyright 2017 - present Atlassian Pty Ltd
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,58 @@
11
# extract-react-types
22

33
> 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+

package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
"scripts": {
99
"test": "jest"
1010
},
11+
"keywords": [
12+
"react",
13+
"flow",
14+
"typescript",
15+
"prop-types",
16+
"documentation"
17+
],
1118
"dependencies": {
1219
"@babel/core": "7.0.0-beta.56",
1320
"@babel/types": "^7.0.0-beta.56",

0 commit comments

Comments
 (0)