Skip to content

Conversation

tschaub
Copy link

@tschaub tschaub commented Apr 10, 2017

The prop-types transform assumes nodes of type ObjectPattern have a parent node with an init property. This is not the case when an ObjectPattern is used in function params or call expression arguments (e.g. function foo({bar}) {} or foo({bar})).

It looks like this is meant to be working with a VariableDeclarator parent. I've added a test that demonstrates the existing problem and updated the transform so the test passes.

@tschaub
Copy link
Author

tschaub commented Apr 10, 2017

It looks like #115 is trying to fix the same issue. I'm happy to update this if you'd prefer to check node.init rather than node.type.

@bvaughn
Copy link
Contributor

bvaughn commented Apr 14, 2017

Sorry mate. Didn't see this. Already merged a similar fix (PR #127).

Going to close this as a dup but I really appreciate the effort!

@bvaughn bvaughn closed this Apr 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants