extract-react-types

0.30.3 • Public • Published

extract-react-types

Extract Flow & TypeScript types from React Components

Features

  • Supports flow and typescript
  • Extracts the description of the props too ( Great for documentation )

Usage

$ yarn add extract-react-types
// Component.js

class Component extends React.Component<{ foo: boolean }> {}

Output:

{
  "kind": "program",
  "classes": [
    {
      "kind": "object",
      "members": [
      {
        "kind": "property",
        "key": {
        "kind": "id",
        "name": "foo"
        },
        "value": {
        "kind": "boolean"
        },
        "optional": false
      }
      ],
      "name": {
      "kind": "id",
      "name": "Component",
      "type": null
      }
    }
  ]
}

Related projects:

Package Sidebar

Install

npm i extract-react-types

Weekly Downloads

116

Version

0.30.3

License

Apache-2.0

Unpacked Size

172 kB

Total Files

13

Last publish

Collaborators

  • noviny
  • zzarcon
  • thejameskyle
  • delcore92