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

Extract the type checker into a separate module #6851

Merged
merged 4 commits into from
May 24, 2016

Conversation

keyz
Copy link
Contributor

@keyz keyz commented May 23, 2016

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

@keyz keyz changed the title Extracted the type checker into a separate module Extract the type checker into a separate module May 23, 2016
'Failed %s type: %s%s',
location,
error.message,
elementOrInstance._debugID ?
Copy link
Contributor Author

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

Copy link
Contributor

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

Copy link
Contributor Author

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.

@ghost
Copy link

ghost commented May 23, 2016

@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
Copy link
Collaborator

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.

@sophiebits sophiebits added this to the 15.y.z milestone May 23, 2016
@keyz keyz merged commit db6ac5c into facebook:master May 24, 2016
@keyz keyz deleted the refactor-type-checker branch May 24, 2016 00:12
@ghost
Copy link

ghost commented May 24, 2016

@keyanzhang updated the pull request.

zpao pushed a commit to zpao/react that referenced this pull request Jun 8, 2016
The type checker is now a separate module under `isomorphic/classic/types`
(cherry picked from commit db6ac5c)
zpao pushed a commit that referenced this pull request Jun 14, 2016
The type checker is now a separate module under `isomorphic/classic/types`
(cherry picked from commit db6ac5c)
@zpao zpao modified the milestones: 15-next, 15.2.0 Jun 14, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants