-
Notifications
You must be signed in to change notification settings - Fork 47.1k
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
Update PropTypes for ReactElement & ReactNode #2343
Conversation
@@ -65,6 +66,9 @@ var emptyFunction = require('emptyFunction'); | |||
|
|||
var ANONYMOUS = '<<anonymous>>'; | |||
|
|||
var elementTypeChecker = createElementTypeChecker(); | |||
var nodeTypeChecker = createRenderableTypeChecker(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be renamed createNodeTypeChecker?
@@ -277,10 +296,8 @@ function createShapeTypeChecker(shapeTypes) { | |||
} | |||
|
|||
function isRenderable(propValue) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be renamed to isNode
as well right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yea, I suppose. isNode
is technically a misnomer, though I guess even the {}s are technically nodes as they are defined today.
Everything in PropTypes are value types or union/array types. These could be called |
Going to leave it as is. |
452ae55
to
770b579
Compare
Update PropTypes for ReactElement & ReactNode
This should have gone in as a part of #2343
This updates the API to match our updated terminology, as well as bring us in line with our definition of a node. It does mean we're currently lying to people about renderables.
Reviewers: @sebmarkbage
Test Plan: npm run jest