How to use the kind2string.getKind function in kind2string

To help you get started, we’ve selected a few kind2string 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 Noviny / pretty-proptypes / src / PropType / index.js View on Github external
console.error(
      `Prop ${
        propType.key
      } has no type; this usually indicates invalid propType or defaultProps config`
    );
    return null;
  }

  const name = propType.kind === 'spread' ? '...' : convert(propType.key);
  const OverrideComponent = overrides[name];
  const commonProps = {
    components,
    name,
    key: name,
    required: !propType.optional,
    type: getKind(propType.value),
    defaultValue: propType.default && convert(propType.default),
    description: description,
    shouldCollapse: shouldCollapseProps,
    typeValue: propType.value
  };

  return overrides[name] ? (
    <OverrideComponent {...commonProps} />
  ) : (
    <Prop {...commonProps} />
  );
};
github atlassian / extract-react-types / packages / pretty-proptypes / src / PropType / index.js View on Github external
console.error(
      `Prop ${
        propType.key
      } has no type; this usually indicates invalid propType or defaultProps config`
    );
    return null;
  }

  const name = propType.kind === 'spread' ? '...' : convert(propType.key);
  const OverrideComponent = overrides[name];
  const commonProps = {
    components,
    name,
    key: name,
    required: !propType.optional,
    type: getKind(propType.value),
    defaultValue: propType.default && convert(propType.default),
    description,
    shouldCollapse: shouldCollapseProps,
    typeValue: propType.value
  };

  return overrides[name] ? <OverrideComponent {...commonProps} /> : <Prop {...commonProps} />;
};
github JedWatson / react-select / PrettyPropTypes / src / Props.js View on Github external
console.error(
      `Prop ${
        propType.key
      } has no type; this usually indicates invalid propType or defaultProps config`,
    );
    return null;
  }

  const name = convert(propType.key);
  const OverrideComponent = overrides[name];
  const commonProps = {
    components,
    name,
    key: convert(propType.key),
    required: !propType.optional,
    type: getKind(propType.value),
    defaultValue: propType.default && convert(propType.default),
    description: description,
    shouldCollapse: shouldCollapseProps,
    typeValue: propType.value,
  };

  return (
    overrides[name] ? <OverrideComponent {...commonProps}/> : <Prop
      {...commonProps}
    />
  );
};

kind2string

Utility to ensure extract-react-types output can be rendered without errors

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Similar packages