Openlayers function in Typescript

0

I'm learning how to use openlayers along with Angular 6, but one of the .on's OL event functions is not recognized by TS, is there any other way to do it without being in the conventional way?

this.imagery.on('postcompose', function(event: ol.render.Event){
  console.log("postcompose");
  var ctx = event.context;
  ctx.restore();
});

It points to 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 the event it usually does not have the context property I need ...

    
asked by anonymous 14.08.2018 / 20:10

1 answer

0

Try the following

this.imagery.on('postcompose', function(event: ol.events.Event){
  console.log("postcompose");
  var ctx = event.context;
  ctx.restore();
  return true;
});
    
14.08.2018 / 20:42