Hacker News new | ask | show | jobs
by berfarah 3562 days ago
Don't you have

  React.PropTypes.shape({
    foo: React.PropTypes.string,
    bar: React.PropTypes.shape({
      fieldNum: React.PropTypes.number
    })
  })
? I'm not saying it isn't verbose, but I'm pretty sure that as of a few months ago, this existed in React natively.
3 comments

PropType support is pretty iffy, see e.g. https://github.com/facebook/react/issues/1833#issuecomment-1...
Thanks, I didn't know that (I've been using React.js just a month, and from beginning with TypeScript)
You can also do ImageUser.propTypes = { image: CustomImage.propTypes }