Détail du package

kind2string

atlassian1.3kMIT0.8.1

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

readme

Kind 2 String - a parser for extract-react-types

Kind 2 String is designed to take the data structures output by extract-react-types and convert them to a (useful) string, as well as performing safe traversal through the output of extract-react-types so that trying to display information in your docs does not throw errors.

It exposes a convert method which allows you to ensure the data structure resolves to a string. It also exposes its converter object, allowing you to overwrite converters of your choice, if you wish to perform some other action other than the default string converter.

Default use-case:

import generatedData from './extract-react-type-write-location';
import convert from 'kind2string';

export default () => <div>convert(generatedData)</div>;

Also, if you are handling the kinds in a custom way, it is good to pass the final kind to kind2string, to ensure that you always pass a string to your react components.

For examples of how to use this, the @atlaskit/docs uses this package. A good pattern on how to implement kind2string can be found in the prettyproptypes file.

changelog

pretty-proptypes

0.8.1

Patch Changes

  • 68bcec6 #152 Thanks @danieldelcore! - Added a safe bail-out for when extract-react-types encounters an unsupported keyword or syntax. In that case, the type will be output as a raw string and summary type will be raw.

0.8.0

Minor Changes

0.7.3

Patch Changes

0.7.2

  • Updated dependencies acb8499:
    • extract-react-types@0.23.0

0.7.1

Patch Changes

0.7.0

Minor Changes

0.6.3

Patch Changes

  • [patch]52e37e6: Introduces flag "EXTRACT_REACT_TYPES_HIDE_ERRORS" to suppress errors

  • Updated dependencies dc4b719:

    • extract-react-types@0.22.0

0.6.2

  • Updated dependencies dc4b719:
    • extract-react-types@0.21.0

0.6.1

Patch Changes

  • [patch]e6cc1f5: Remove dangerous debug code that broke everything

0.6.0

Minor Changes

  • [minor]533d172: Add support for opaque types

0.5.6

  • Updated dependencies d232e30:
    • extract-react-types@0.19.0

0.5.5

  • Updated dependencies 907688c:
    • extract-react-types@0.18.0

0.5.4

Patch Changes

  • [patch]287e4b4:
    • Updated build to use preconstruct (this shouldn't affect usage, but calling this out just in case)
  • [patch]4b3b4a4:

    • Add logicalExpression converter
  • Updated dependencies e682bbb:

    • extract-react-types@0.17.0

0.5.3

  • [patch]e401ba8:
    • Add converter for typeCastExpression

0.5.2

  • Updated dependencies 277b0be:
  • Updated dependencies 8f04dad:
  • Updated dependencies 6bc521c:
    • extract-react-types@0.16.0

0.5.1

Thanks Michael Blaszczyk for these contributions!

  • Add converters for typeParam and typeParamsDeclaration
  • Add reduceToObj function - previously this lived in pretty-proptypes

0.5.0

  • Add new converters for export and exportSpecifier types
  • Modernize dependent version of extract-react-types