JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 256
  • Score
    100M100P100Q83894F
  • License ISC

Package Exports

  • prop-types-docs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (prop-types-docs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

prop-types-docs CircleCI

Document your prop types

import PropTypes, { withPropDocs } from 'prop-types-docs'

const Component = ({ name, age, contacts }) => {
  <div>
    name: {name}
    age: {age}

    contacts:
    {contacts.map(() => ...)}
  </div>
}

export default withPropDocs({
  name: { type: PropTypes.string, required: true },
  age: { type: PropTypes.number, required: true },
  contacts: { type: PropTypes.array, default: [] },
})(Component)

Is the equivalent of

import PropTypes from 'prop-types'

Component.propTypes = {
  name: PropTypes.string.isRequired,
  age: PropTypes.number.isRequired,
  contacts: PropTypes.array
}

Component.defaultProps = {
  contacts: []
}