-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
Extract the type checker into a separate module #6851
Conversation
'Failed %s type: %s%s', | ||
location, | ||
error.message, | ||
elementOrInstance._debugID ? |
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.
Not sure if this is a good way to branch on the type of the argument
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.
You shouldn't need to branch. Just pass in the element as the argument. You can get the element off the instance by using instance._currentElement
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.
Cool, I'm fixing this now and it will take either an element or a debugID.
@keyanzhang updated the pull request. |
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
* | ||
* @providesModule checkTypes |
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.
Can we call this checkPropTypes or something else more descriptive? (I know you don't really like calling the context types prop types.) This name needs to be unique across the whole Facebook codebase.
@keyanzhang updated the pull request. |
The type checker is now a separate module under `isomorphic/classic/types` (cherry picked from commit db6ac5c)
The type checker is now a separate module under `isomorphic/classic/types` (cherry picked from commit db6ac5c)
Follow-up of #6824. The type checker is now a separate module under
isomorphic/classic/types
, which takes either a React element or an internal component instance. As a result,ReactCompositeComponent
now displays the component stack info when type checking fails. Also, context type errors are memorized and will only be shown once.CC @spicyj