byte-fe / react-model

The next generation state management library for React
236 stars 23 forks source link

Property 'entries' does not exist on type 'ObjectConstructor'. TS2339 #130

Closed muescha closed 5 years ago

muescha commented 5 years ago

I have a:

  1. [x] Issue:

    • [x] Provide error messages including stacktrace ❌

    • [ ] Provide a minimal sample reproduction. Create a reproduction based on this sandbox πŸš€

    • [x] Did you check this issue wasn't filed before? πŸ€”

    • [ ] Elaborate on your issue. What behavior did you expect? ❓

    • [x] State the versions of react-model and relevant libraries. Which browser / node / ... version? 🚧

TypeScript error in /Users/muescha/Work/react/xxx/node_modules/react-model/src/helper.ts(46,10):
Property 'entries' does not exist on type 'ObjectConstructor'.  TS2339

    44 | ) => {
    45 |   const ret: any = {}
  > 46 |   Object.entries<Action>(actions).forEach(([key, action]) => {
       |          ^
    47 |     ret[key] = consumerAction(action, modelContext)
    48 |   })
    49 |   return ret
  | Software         | Version(s) |
  | ---------------- | ---------- |
  | react-model           | 3.0.1 |
  | Node             | v10.15.3 |
  | react         | 16.9.0 |
  | Operating System | 10.14.5 (18F132) macOS MOjave |
β”œβ”€β”€ @types/react@16.9.2 invalid
β”œβ”€β”€ @types/react-dom@16.9.0 invalid
β”œβ”€β”€ d3@5.12.0
β”œβ”€β”€ d3blackbox@1.2.0
β”œβ”€β”€ moment@2.24.0
β”œβ”€β”€ moment-range@4.0.2
β”œβ”€β”€ react@16.9.0
β”œβ”€β”€ react-dates@21.1.0
β”œβ”€β”€ react-dom@16.9.0
β”œβ”€β”€ react-model@3.0.1
β”œβ”€β”€ react-scripts@3.1.2
β”œβ”€β”€ react-with-direction@1.3.1
└── typescript@3.6.3
ArrayZoneYour commented 5 years ago

Thanks for feedbackπŸ’—. Can you provide a minimal sample project with tsconfig.json?I cannot reproduce this error 😒

ArrayZoneYour commented 5 years ago

@muescha https://stackoverflow.com/questions/45422573/property-entries-does-not-exist-on-type-objectconstructor

muescha commented 5 years ago

thx this resolves the problem.

i changed lib and target to exnext:


    "lib": [
      "dom",
      "esnext"
    ],
    "jsx": "react",
    "target": "esnext",

PS: i was exporting an React project from codesandbox without changes ...