After initializing my component, certain variables remain unassigned until a later point. I am seeking a way to utilize these variables beyond the initialization process, but I am unsure of how to do so. Below is my attempted code snippet, which throws an error stating 'Type 'Map' is not assignable to type 'undefined'.
export class DummyComponent implements AfterViewInit {
map = null;
mousePosition = undefined;
ngAfterViewInit(): void {
this.map = new Map({
target: 'map',
layers: [layer],
view: view
});
}
update(){
this.map.on(...) => {...}
}