Multiple Typescript errors with OpenLayers 6.6.1
See original GitHub issueWe upgraded OpenLayers from 6.5.0 to version 6.6.1 in our Angular 11 project (and removed the @types/ol dependency). Various compile errors occure in the OpenLayers *.d.ts files:
Error: node_modules/ol/ImageBase.d.ts:32:48 - error TS2694: Namespace '"./node_modules/ol/ImageState"' has no exported member 'default'.
32 protected state: import("./ImageState.js").default;
~~~~~~~
Error: node_modules/ol/Tile.d.ts:131:47 - error TS2694: Namespace '"./node_modules/ol/TileState"' has no exported member 'default'.
131 protected state: import("./TileState.js").default;
~~~~~~~
Error: node_modules/ol/geom/SimpleGeometry.d.ts:27:53 - error TS2694: Namespace '"./node_modules/ol/geom/GeometryLayout"' has no exported member 'default'.
27 protected layout: import("./GeometryLayout.js").default;
~~~~~~~
Error: node_modules/ol/source/Cluster.d.ts:110:31 - error TS2314: Generic type 'Feature<Geometry>' requires 1 type argument(s).
110 protected features: Array<Feature>;
~~~~~~~
Error: node_modules/ol/source/Cluster.d.ts:121:23 - error TS2314: Generic type 'VectorSource<Geometry>' requires 1 type argument(s).
121 protected source: VectorSource;
~~~~~~~~~~~~
Error: node_modules/ol/source/Raster.d.ts:309:5 - error TS2416: Property 'getImageInternal' in type 'RasterSource' is not assignable to the same property in base type 'ImageSource'.
Type '() => null' is not assignable to type '(extent: number[], resolution: number, pixelRatio: number, projection: Projection) => ImageBase'.
Type 'null' is not assignable to type 'ImageBase'.
309 getImageInternal(): null;
~~~~~~~~~~~~~~~~
I think the last one is already mentioned in #12532
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:12 (5 by maintainers)
Top Results From Across the Web
How do I fix Typescript errors in OpenLayers 6.6.1
After upgrading to OpenLayers 6.6. 1 I am receiving hundreds of typescript errors caused by generics. Generic type 'Feature' requires 1 type ...
Read more >rlayers examples - React Components for OpenLayers 6+
rlayers is an opinionated set of React components for OpenLayers. It's design policy is: Fully Typescript-typed; Do everything that faces the user the...
Read more >Regular Shapes - OpenLayers
This example shows how several regular shapes or symbols (representing x , cross , star , triangle , square and stacked ) can...
Read more >Chapter 6 Leaflet | Introduction to Web Mapping
Using Leaflet, you can create a simple map using just two or three JavaScript expressions, or you can build a complex map using...
Read more >An Open Source Spatial Data Infrastructure for the Cryosphere
spatial database management system (DBMS), map and web server, JavaScript ... Open source software including GeoServer, PostgreSQL, PostGIS, OpenLayers,.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ahocevar I’ve cloned the repo locally in my PC, served the app and everything goes well! I think that in my project the reason that Angular shows that errors is because (maybe) the version of Angular is 10.0.8 and the OL version is the latest one.
If i use the OL version 6.5.0 (older) in the same project no errors show up! For deploying the only solution until now is to use the 6.5.0 versione, otherwise I can’t do anything
The flag “skipLibCheck”: true in tsconfig is not a solution, it is a bad practice and it shoul be fixed.