Validating PropTypes when a class is created - #5475
Conversation
…sso de desenvolvimento"
|
There are a lot of unrelated commits here. Can you clean that up? |
|
Yes, sorry about that (and also the fact that they're written in another language)... I'm not so sure how to do that smoothly... I have a branch in the forked repo where those commits are relevant. Could you possibly suggest a way for me to clean up only the branch which this pull request refers to? |
|
@rppc In the branch you create for this pull request, you can do a |
|
@jimfb After rebasing, I ran 'git merge --squash' but got "(nothing to squash)Already up-to-date". Perhaps I'm missing something... |
|
|
|
Definitely not the smoothest way to do this, but I've created a new branch where the commit history has been cleaned up. Please refer to this pull request. |
|
I have some instructions here that should be helpful with what I would have done. I know you just made a new PR to work from which is great but perhaps for the future git remote add facebook git@github.com:facebook/react.git
git fetch facebook
git branch onlyCode2 --no-track facebook/master
git diff facebook/master onlyCode | patch -p1
# add and commit normally, this will be a standalone commit with only code
# git add
# git commit
# make a new PR |
|
@zpao I ended up doing something similar, but it looks like I'll have to do it again because I accidentally let all those commits back in... |
Note: This is the same pull request, but I've had to switch branches.
Following this bug report, the PropTypes are now checked in development mode when the class is created, so that, for instance, the call:
will result in a warning being logged, and optionalEnum being cleared from the propTypes object.
Up to this point, this check only occurred when ReactElement.createElement was called in development mode. Some refactoring might be needed in order to avoid unnecessary tests when ReactElement.createElement is called in development mode.
Test cases were included in the file ReactClass-test.js (see the last test).