facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 356 forks source link

Got Cannot read property '@@toStringTag' of undefined #256

Closed wmertens closed 5 years ago

wmertens commented 5 years ago

Somehow, this line is executed when propValue is undefined: https://github.com/facebook/prop-types/blob/48eb8faef9d70a1474bb31f03a2f3af802d154a4/factoryWithTypeCheckers.js#L508

It would be good to put a guard and a warning?

ljharb commented 5 years ago

@wmertens do you have any more information? I can't figure out how to reproduce this issue.

wmertens commented 5 years ago

@ljharb it's being triggered by one of https://github.com/StratoKit/strato-db/blob/1f5535b0bcd0622439f6c70ed6ab2a1acac151d3/src/JsonModel.js#L28-L96

Could it be PropTypes.oneOf([false, undefined, null])?

ljharb commented 5 years ago

yes, that is exactly it, thank you :-) (note that oneOf can't ever match undefined or null; if it's optional they'll always be allowed, and if required they'll always be forbidden)

ljharb commented 5 years ago

v15.7.2 is released; please file an issue if you see any problems!