ljharb / prop-types-tools

Custom React PropType validators
MIT License
671 stars 50 forks source link

TypeError: Object.entries is not a function (version 2.4) #10

Closed danielzlotnik closed 7 years ago

danielzlotnik commented 7 years ago
TypeError: Object.entries is not a function
    at propsThunkify (C:\dev\source\test\main\src\node_modules\airbnb-prop-types\build\between.js:106:17)
    at betweenValidator (C:\dev\source\test\main\src\node_modules\airbnb-prop-types\build\between.js:144:20)
    at Object.<anonymous> (C:\dev\source\test\main\src\node_modules\airbnb-prop-types\build\sequenceOf.js:41:101)
    at Module._compile (module.js:541:32)
    at Object.require.extensions.(anonymous function) [as .js] (C:\dev\source\test\main\src\node_modules\node-jsx\index.js:29:12)
    at Module.load (module.js:458:32)
    at tryModuleLoad (module.js:417:12)
    at Function.Module._load (module.js:409:3)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)

Encountered this bug while trying to use react-dates. Had to force usage of version 2.2.0.

lencioni commented 7 years ago

Hi @danielzlotnik thanks for the report! This package assumes that Object.entries (and likely other things) is shimmed, which can be achieved by using airbnb-js-shims or an equivalent package (as mentioned in the readme).

14850842 commented 7 years ago

Same issue here. We are using babel-polyfill with presets of es2015,stage-0 & react.Would we need to update to es2017?

ljharb commented 7 years ago

@14850842 yes.

sattaman commented 7 years ago

I found this wasn't needed on the newest node

webgio commented 7 years ago

Same here with a ejected create-react-app setup. Tried to enable es2017 preset but with no luck. Is there any simple way to fix this? Preferably without having to understand Babel... :)

webgio commented 7 years ago

Solved it by putting import 'airbnb-js-shims/target/es2015' before import { SingleDatePicker } from 'react-dates'

benbonnet commented 7 years ago

works on chrome (56.0) but not on safari (9.1.3). adding airbnb-js-shims solves this issue; although it took us a while before landing here (a better highlight on the react-dates README maybe ?)

ljharb commented 7 years ago

I've addressed this with b09134f93d1fb45a8c48d5a0e6c265fdbad3a1ee by removing the requirement to polyfill. (see also https://github.com/airbnb/react-dates/issues/405#issuecomment-289521845 and #9)

Released as v2.5.2.