0
I’m learning to use openlayers along with Angular 6, but one of the OL event functions. on is not recognized by TS, has some other way to do it than in the conventional way?
this.imagery.on('postcompose', function(event: ol.render.Event){
console.log("postcompose");
var ctx = event.context;
ctx.restore();
});
He points out the error
Type '(event: Event) => void' is not assignable to type '(evt: Event) => boolean'.
Types of parameters 'event' and 'evt' are incompatible.
Type 'ol.events.Event' is not assignable to type 'ol.render.Event'.
If I use Event normally it does not have the context property I need...
Tries
npm install --save @types/openlayers
– thxmxx
I’m already using this version :/ , the map is being loaded normally, I was able to draw Features among other things, only this function does not work and n find a solution for this...
– Julio Negri Mirandola
So... but I told you to install @types/openlayers and not openlayers... Actually you should install both.
– thxmxx
But your mistake is another in fact
– thxmxx