{"id":51942922,"url":"https://github.com/atlassian/babel-plugin-react-flow-props-to-prop-types","last_synced_at":"2026-07-28T21:02:28.486Z","repository":{"id":21535875,"uuid":"92229361","full_name":"atlassian/babel-plugin-react-flow-props-to-prop-types","owner":"atlassian","description":"Convert Flow React props annotation to PropTypes","archived":false,"fork":false,"pushed_at":"2023-12-15T08:22:03.000Z","size":483,"stargazers_count":229,"open_issues_count":13,"forks_count":10,"subscribers_count":6,"default_branch":"master","last_synced_at":"2026-04-21T01:30:00.020Z","etag":null,"topics":["babel","flow","flowtype","proptypes","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/atlassian.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-23T23:25:57.000Z","updated_at":"2026-03-05T15:02:31.000Z","dependencies_parsed_at":"2023-12-15T09:40:16.770Z","dependency_job_id":null,"html_url":"https://github.com/atlassian/babel-plugin-react-flow-props-to-prop-types","commit_stats":null,"previous_names":["thejameskyle/babel-plugin-react-flow-props-to-prop-types"],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/atlassian/babel-plugin-react-flow-props-to-prop-types","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fbabel-plugin-react-flow-props-to-prop-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fbabel-plugin-react-flow-props-to-prop-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fbabel-plugin-react-flow-props-to-prop-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fbabel-plugin-react-flow-props-to-prop-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/atlassian","download_url":"https://codeload.github.com/atlassian/babel-plugin-react-flow-props-to-prop-types/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/atlassian%2Fbabel-plugin-react-flow-props-to-prop-types/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":36007830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-28T02:00:06.341Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["babel","flow","flowtype","proptypes","react"],"created_at":"2026-07-28T21:02:27.887Z","updated_at":"2026-07-28T21:02:28.445Z","avatar_url":"https://github.com/atlassian.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# babel-plugin-react-flow-props-to-prop-types\n\n\u003e Convert Flow React props annotation to PropTypes\n\n- Supports most Flow types (see below)\n- Maintains comments\n- Works across modules (can import types)\n\n**Supported:**\n\n- `any/mixed` Unknown types\n- `void/null` Empty types\n- `number / string / boolean` Primitives\n- `42 / \"hello\" / true` Literals\n- `[1, 2, 3]` Tuples\n- `{ ... }` Objects\n  - `{ prop: number }` Object Properties\n  - `{ prop?: number }` Optional properties\n  - `{ [prop: string]: number }` Optional Indexers\n- `{ [key: string]: number }` Object indexers\n- `Array\u003cstring\u003e` Arrays\n- `Object` Unknown Objects\n- `Function` Unknown Functions\n- `RegExp` regular expressions\n- `boolean | string` Unions\n- `{ foo: number } \u0026 { bar: string }` Intersections\n- Referencing other types:\n  - `type Alias = number` - Type Aliases\n  - `interface Stuff {}` - Interfaces\n  - `class Thing {}` - Class Declarations\n  - `import type {Alias} from \"./other\";` Type imports\n\n**Unsupported:**\n\n- `{ a: number, [b: string]: number }` Combining properties and indexers\n- `{ [a: string]: number, [b: string]: number }` Multiple indexers\n- `{ (): void }` Object call properties\n- `a.b` Qualified type identifiers\n- `import typeof Export from \"./other\";` Typeof imports\n\n## Example\n\nIn:\n\n```js\nclass MyComponent extends React.Component {\n  props: {\n    // Add a class name to the root element\n    className: string\n  };\n\n  // ...\n}\n```\n\nOut:\n\n```js\nclass MyComponent extends React.Component {\n  props: {\n    // Add a class name to the root element\n    className: string\n  };\n  static propTypes = {\n    // Add a class name to the root element\n    className: PropTypes.string.isRequired\n  };\n\n  // ...\n}\n```\n\n## Installation\n\n```sh\n$ yarn add prop-types prop-types-extra\n$ yarn add --dev babel-plugin-react-flow-props-to-prop-types\n```\n\n\u003e **Note:** [`prop-types-extra`](https://github.com/react-bootstrap/prop-types-extra)\n\u003e is necessary for intersection type support.\n\n## Usage\n\n### Via `.babelrc` (Recommended)\n\n**.babelrc**\n\n```js\n{\n  \"plugins\": [\n    [\"react-flow-props-to-prop-types\", { /* options */ }]\n  ]\n}\n```\n\n### Via CLI\n\n```sh\n$ babel --plugins react-flow-props-to-prop-types script.js\n```\n\n### Via Node API\n\n```javascript\nrequire(\"babel-core\").transform(\"code\", {\n  plugins: [\n    [\"react-flow-props-to-prop-types\", { /* options */ }]\n  ]\n});\n```\n\n## Options\n\n### `resolveOpts` (optional)\n\nPassed through to [node-resolve](https://github.com/substack/node-resolve)\n\n### Override type used in propTypes\n\nSometimes you have Flow types which cannot be translated into PropTypes. In\nthese scenarios you can provide your own type:\n\n```js\nimport type {PropType} from \"babel-plugin-react-flow-props-to-prop-types\";\n\nclass MyComponent extends React.Component {\n  props: {\n    foo: PropType\u003cUnknownFunctionType, Function\u003e\n  };\n}\n```\n\nPropType is defined as:\n\n```js\ntype PropType\u003cT, R\u003e = T;\n```\n\nSo Flow will use the first type you provide, while this Babel plugin will use\nthe second.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian%2Fbabel-plugin-react-flow-props-to-prop-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fatlassian%2Fbabel-plugin-react-flow-props-to-prop-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fatlassian%2Fbabel-plugin-react-flow-props-to-prop-types/lists"}