React-Type-R icon indicating copy to clipboard operation
React-Type-R copied to clipboard

has.check must compile to custom check in props declaration

Open gaperton opened this issue 8 years ago • 1 comments

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 avatar May 13 '17 16:05 gaperton

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.

gaperton avatar May 14 '17 15:05 gaperton