Skip to content

Conversation

@trotzig
Copy link
Contributor

@trotzig trotzig commented May 18, 2017

I was using React-PropTypes-to-prop-types to convert files in our repo,
and I noticed that this type of construct wouldn't be converted:

const { PropTypes } = require('react');

To fix this, I modified a function that handled constructs of the
following kind:

const { PropTypes } = React;

Naming the test fixture was a little hard, since there are other
fixtures testing almost the same thing. I decided to use the term
"direct" to refer to a destructure done "directly" aimed at a require.

I was using React-PropTypes-to-prop-types to convert files in our repo, and I noticed that this type of construct wouldn't be converted: const { PropTypes } = require('react'); To fix this, I modified a function that handled constructs of the following kind: const { PropTypes } = React; Naming the test fixture was a little hard, since there are other fixtures testing almost the same thing. I decided to use the term "direct" to refer to a destructure done "directly" aimed at a require.
@flarnie flarnie self-requested a review May 18, 2017 15:07
@flarnie
Copy link
Contributor

flarnie commented May 18, 2017

Very nice! Thanks for adding a test and for making this improvement. :)

@flarnie flarnie merged commit 367a727 into reactjs:master May 18, 2017
@trotzig trotzig deleted the fix-react-ptp-for-destructured-require branch May 18, 2017 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants