More specific typeof check for polyfilled Symbol
Let's get more specific with our tests. Symbol has to be a function if it's a polyfill. There are no object polyfills out there. (If there is, ping me and I'll add support) Instead of checking if Symbol is undefined, let's check if it's a function instead since instanceof is depending that Symbol is already a function.
Sam Balana committed
Apr 7, 2016 at 16:57 UTC
05820f89c15159994247899721aef8ae14c7ead9
1 file changed
+1
-1
src/isomorphic/classic/types/ReactPropTypes.js
+1
-1
@@ -419,7 +419,7 @@ function isSymbol(propType, propValue) {
419
}
420
421
// Fallback for non-spec compliant Symbols which are polyfilled.
422
- if (typeof Symbol !== 'undefined' && propValue instanceof Symbol) {
422
+ if (typeof Symbol === 'function' && propValue instanceof Symbol) {
423
return true;
424
}
425