React-Type-R
React-Type-R copied to clipboard
has.check must compile to custom check in props declaration
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.
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.