Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

has.check must compile to custom check in props declaration #2

Open
gaperton opened this issue May 13, 2017 · 1 comment
Open

has.check must compile to custom check in props declaration #2

gaperton opened this issue May 13, 2017 · 1 comment

Comments

@gaperton
Copy link

gaperton commented May 13, 2017

So, it should use this form of the prop check:

function(props, propName, componentName) {
    if (!/matchme/.test(props[propName])) {
      return new Error(
        'Invalid prop `' + propName + '` supplied to' +
        ' `' + componentName + '`. Validation failed.'
      );
    }
  },

Which gives us an opportunity to drop prop-types dependency completely, always emitting our custom checks. Which is gooooood.

@gaperton
Copy link
Author

With that change, we will receive the solid core annotation subset working for both props and state.

Annotation level 1 - just assertions. Works for everything.
Type, Type.isRequired, Type.has.check

Level 2 - defaults, changes, and events. Wors for props and state.
defaultValue, Type.value, Type.watcher, Type.has.events, Type.has.changeEvents

Level 3 - serialization, hooks, shared annotations. Just state.

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

No branches or pull requests

1 participant