react-props-to-json-ts
TypeScript icon, indicating that this package has built-in type declarations

1.1.5 • Public • Published

react-props-to-json-ts

React props to json schema used for form-reder

Install

yarn add react-props-to-json-ts --dev

or

npm install --save-dev react-props-to-json-ts

How to use

const propsToJSON = require('react-props-to-json-ts');
// input file path
const result = propsToJSON('filename.tsx');

console.log(result);

API

(path, handleError)

argument type required description
path string true The path of parsing file
handleError (err: any) => void false Callback for handle the error

Note

  • The tool will skip the prop without @title tag.
  • The component also need a @title tag, otherwise will get null.
  • If props is empty, will get a null value.

Example

pls follow the exmaple

Support types

type format
union select
number input number
boolean checkbox
string input
object auto
array auto
ReactNode richtext

Dependents (0)

Package Sidebar

Install

npm i react-props-to-json-ts

Weekly Downloads

1

Version

1.1.5

License

MIT

Unpacked Size

16 MB

Total Files

22

Last publish

Collaborators

  • timluo465