prop-types: PropTypes.node forbids true but flow typing accepts it, causing runtime warning

PropTypes.node does not accept true according to #109.

But flow typing in React declares export type ReactEmpty = null | void | boolean; https://github.com/facebook/react/blob/b6173e643a4311b9b1cf039824b2f3d7b974b8cf/packages/shared/ReactTypes.js#L18 so it accepts true without error for type checking, but prop-types shows warning for it.

(Actually I’m using equivalent TypeScript type definition along with material-ui library which uses prop-types.)

About this issue

Most upvoted comments

AFAIK current state is:

  • React: accepts true and render empty at least since 2017/11
  • React’s flow type: accepts true at least since 2014
  • @types/react: accepts true
  • PropTypes.node: rejects true

So React and its flow type are already in sync for true. My guess is that React accepts true from the beginning. But I’m in doubt, so filled https://github.com/facebook/react/issues/17871 .

Ah, I misunderstood. You’re saying that react itself changed to allow true at some point, and PropTypes.node does not properly allow it?

It’d be great if we could figure out in which version that changed.