Nerdiest Political Manifesto

    junction-proptype-decorator
    TypeScript icon, indicating that this package has built-in type declarations

    0.2.2 • Public • Published

    Junction PropType Decorator

    Requirements: Node.js 6+

    Map your Junction entity schema to an output suitable for React prop validation

    Install

    npm install junction-proptypes-decorator --save

    Usage

    Decorate your schema-defined entities with @proptypeable and access the custom prop type via the shape getter.

    @proptypeable
    class Car {
    
      wheels = 4;
      electric = true;
    
    }
    
    Car.schema = {
      type: 'entity',
      props: {
        wheels: {
          type: 'number',
          isRequired: true
        },
        electric: {
          type: 'boolean',
          isRequired: true
        }
      }
    }
    
    class CarRow extends Component {
    
      static propTypes = {
        car: Car.shape.isRequired
      }
    
      ...
    }
    

    Licence

    MIT

    Install

    npm i junction-proptype-decorator

    DownloadsWeekly Downloads

    0

    Version

    0.2.2

    License

    MIT

    Unpacked Size

    78.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • andy-shea