I'm having problems using the on in typescript, I need to use event.context but it's from ol.render.Event but I only can receive ol.events.Event
this.imagery.on('precompose', function(event){})
To get around this I tried this
this.imagery.on('precompose', function(event: ol.render.Event){})
But I get this error
ERROR in src/app/app.component.ts(141,35): error TS2345: Argument of
type '(event: Event) => void' is not assignable to parameter of type
'EventsListenerFunctionType'.
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'.
Property 'vectorContext' is missing in type 'Event'.