milesj / babel-plugin-typescript-to-proptypes

Generate React PropTypes from TypeScript interfaces or type aliases.
MIT License
367 stars 25 forks source link

Breaks existing prop-types deconstruction for jest tests #40

Closed drewdrewthis closed 4 years ago

drewdrewthis commented 4 years ago

Code

import {
  number,
  string,
  oneOfType,
  arrayOf,
  node,
  bool,
  func,
  shape,
  InferProps
} from 'prop-types'

....

export const propTypes = {
  id: string,
  placeholder: string,
  disabled: bool,
  className: string,

OUTPUT:

● Test suite failed to run

    ReferenceError: string is not defined

      29 |
      30 | export const propTypes = {
    > 31 |   id: string,
         |       ^
      32 |   placeholder: string,
      33 |   disabled: bool,
      34 |   className: string,
milesj commented 4 years ago

Is fixed in the latest version.