I'm trying to access a value inside of a ReadonlyMap<string, object> and despite the key being there it returns undefined. Can anyone see why this is happening?
public getById(id: string): Observable<MapModel | null> {
console.log('id', id)
return this.maps$.pipe(
tap((map: ReadonlyMap<string, MapModel>) => console.log('map', map)),
map((map: ReadonlyMap<string, MapModel>) => map.get(id) ?? null),
tap(a => console.log('result', a))
);
}
``` ```ts
public ngOnInit(): void {
this.map$ = this.route.params.pipe(
map((params: Params): string => params['id']),
tap(a => console.log('test', a)),
switchMap((id: string) => this.dataService.getById(id))
);
}