How to use the extract-react-types function in extract-react-types

To help you get started, we’ve selected a few extract-react-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atlassian / extract-react-types / website / src / App.js View on Github external
const STARTING_CODE = {
  code: `type ButtonPropType = {
    /* This is*/
  label: string
}

class Button extends React.Component{

}`,
  typeSystem: 'flow'
};

class App extends Component {
  state = {
    code: STARTING_CODE.code,
    dataForPropTypes: ert(STARTING_CODE.code, STARTING_CODE.typeSystem),
    typeSystem: STARTING_CODE.typeSystem,
    error: null
  };

  updateCode = code => {
    console.log(compress(code));
    try {
      const ast = ert(code, this.state.typeSystem);
      this.setState({
        dataForPropTypes: ast,
        error: null
      });
    } catch (error) {
      this.setState({
        error
      });
github atlassian / extract-react-types / website / src / pages / repl / index.js View on Github external
code: `type ButtonPropType = {
    /* Handler to be called on click of the button*/
  onClick: () => void
}
class Button extends React.Component{
}`,
  typeSystem: 'flow'
};

class App extends Component {
  state = {
    code:
      uriUtils.parseQuery().code_lz !== undefined
        ? uriUtils.decompress(uriUtils.parseQuery().code_lz)
        : STARTING_CODE.code,
    dataForPropTypes: ert(STARTING_CODE.code, STARTING_CODE.typeSystem),
    typeSystem: STARTING_CODE.typeSystem,
    error: null
  };

  updateCode = code => {
    try {
      const ast = ert(code, this.state.typeSystem);
      this.setState({
        dataForPropTypes: ast,
        error: null
      });
      uriUtils.updateQuery({ code: uriUtils.compress(code) });
    } catch (error) {
      this.setState({
        error
      });
github atlassian / extract-react-types / website / src / App.js View on Github external
updateCode = code => {
    console.log(compress(code));
    try {
      const ast = ert(code, this.state.typeSystem);
      this.setState({
        dataForPropTypes: ast,
        error: null
      });
    } catch (error) {
      this.setState({
        error
      });
      window.error = error;
    }
  };
github atlassian / extract-react-types / website / src / pages / repl / index.js View on Github external
updateCode = code => {
    try {
      const ast = ert(code, this.state.typeSystem);
      this.setState({
        dataForPropTypes: ast,
        error: null
      });
      uriUtils.updateQuery({ code: uriUtils.compress(code) });
    } catch (error) {
      this.setState({
        error
      });
      window.error = error;
    }
  };

extract-react-types

Parse prop-types from react components using typescript or flow

MIT
Latest version published 2 years ago

Package Health Score

64 / 100
Full package analysis