activated typescript strict mode

This commit is contained in:
2021-05-22 15:30:04 +02:00
parent a195fafa6b
commit cb2c028ca4
76 changed files with 511 additions and 296 deletions

View File

@@ -2,8 +2,10 @@ import {Component, OnInit} from '@angular/core';
import {SongService} from '../songs/services/song.service';
import {GlobalSettingsService} from '../../services/global-settings.service';
import {Observable} from 'rxjs';
import {map, switchMap} from 'rxjs/operators';
import {filter, map, switchMap} from 'rxjs/operators';
import {ShowSongService} from '../shows/services/show-song.service';
import {GlobalSettings} from '../../services/global-settings';
import {Song} from '../songs/services/song';
@Component({
selector: 'app-guest',
@@ -11,15 +13,31 @@ import {ShowSongService} from '../shows/services/show-song.service';
styleUrls: ['./guest.component.less'],
})
export class GuestComponent implements OnInit {
public songs$: Observable<Observable<string>[]>;
public songs$: Observable<Observable<string>[]> | null = null;
public constructor(private songService: SongService, private globalSettingsService: GlobalSettingsService, private showSongService: ShowSongService) {}
public constructor(
private songService: SongService,
private globalSettingsService: GlobalSettingsService,
private showSongService: ShowSongService
) {}
public ngOnInit(): void {
this.songs$ = this.globalSettingsService.get$.pipe(
filter(_ => !!_),
map(_ => _ as GlobalSettings),
map(_ => _.currentShow),
switchMap(_ => this.showSongService.list$(_)),
map(_ => _.sort((x, y) => x.order - y.order).map(showSong => this.songService.read$(showSong.songId).pipe(map(song => song.text))))
filter(_ => !!_),
map(_ => _),
map(_ =>
_.sort((x, y) => x.order - y.order).map(showSong =>
this.songService.read$(showSong.songId).pipe(
filter(_ => !!_),
map(_ => _ as Song),
map(song => song.text)
)
)
)
);
}
}