Skip to content

PropTypes for Preact #902

Description

@rumkin

Hi. I've realised PropTypes's alike extensible type checker which produce nice-looking report object. Instead of PropTypes which print's some output into console. And I want to add integration for preact. Is there any way to make it play together without patching preact itself?

It could be used like so:

const TypedProps = require('typed-props');

const userShape = TypedProps.shape({
    username: TypedProps.string.isRequired,
    age: TypedProps.number,
});

TypedProps.check({}, userShape); // -> returns array of issues: {path:string[], rule:string, params:{}}

Thanks for any advise.

P.S. Here it is.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions