@samitouri / QOS-React / commits / 5485ac8f6c

Support for ES6 polyfills

Most ES6 polyfills will add support by implementing `Symbol` as a function. This causes `typeof` to return `function` rather than `symbol` for polyfilled clients.

Sam Balana committed Mar 31, 2016 at 13:47 UTC 5485ac8f6c77a487d7627bf2b994992e9e03c1e3
1 file changed +6
src/isomorphic/classic/types/ReactPropTypes.js
+6
@@ -419,6 +419,12 @@ function getPropType(propValue) {
419 // passes PropTypes.object.
420 return 'object';
421 }
422 + if (propType === 'function' && typeof Symbol === 'function' &&
423 + propValue instanceof Symbol) {
424 + // ES6 polyfills will return 'function' rather than 'symbol' for typeof a
425 + // Symbol.
426 + return 'symbol';
427 + }
428 return propType;
429 }
430