JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 328
  • Score
    100M100P100Q86028F
  • 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

doc-prop-types CircleCI

Document your prop types

import PropTypes, { withDocProps } from 'doc-prop-types'

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

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

export default withDocProps({
  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: []
}