barteloma
barteloma

Reputation: 6855

Openslyers import error in Angular component

I have installed openlayers to my angular 12 project.

npm install ol

and

npm install --save @types/ol

But when I import in home component:

  import Map from 'ol/Map';

throws exception:

Error: node_modules/ol/ImageBase.d.ts:32:48 - error TS2694: 
 Namespace '"C:/Dev/my-app/node_modules/ol/ImageState"' has no exported 
member 'default'.

 protected state: import("./ImageState.js").default;     
 protected state: import("./TileState.js").default;
 protected layout: import("./GeometryLayout.js").default;

Upvotes: 2

Views: 933

Answers (1)

Siva Ravula
Siva Ravula

Reputation: 31

One solution is updating tsconfig.json.

In tsconfig.json file at the compilerOptions object add "skipLibCheck": true.

This will resolve the issue.

Upvotes: 3

Related Questions