alexjkni.dev
alexjkni.dev

Reputation: 35

Object is not generic (google-maps-react)

Just added google-maps-react along with @types/googlemaps to my project. Now when I attempt to bundle the project I get the below error.

../../node_modules/google-maps-react/index.d.ts:29:14 - error TS2315: Type 'Object' is not generic.

29 type Style = Object<string, string | number | boolean>
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

What exactly is causing this?

Upvotes: 1

Views: 851

Answers (2)

sammalfix
sammalfix

Reputation: 320

In tsconfig.json > "compilerOptions", set "skipLibCheck": true. It worked in my project in the same situation.

Answer found here: https://github.com/openlayers/openlayers/issues/12609#issuecomment-895052721.

Why it makes sense:

Using "skipLibCheck": true is the solution, not a workaround. [...] In general, a sane approach for an application is to trust its dependencies to be properly typed. So it is not necessary for an application to type check its dependencies. This is also the reason why the default for skipLibCheck is true.

https://github.com/openlayers/openlayers/issues/12497#issuecomment-893339885

Upvotes: 0

Derry Nixon
Derry Nixon

Reputation: 11

You need to add types for google-maps-react

npm install @types/google-maps-react

Upvotes: 1

Related Questions