Ao seguir a aula 04 vídeo 06 Validador assíncrono do Curso Angular Parte 2, recebo o erro: ERROR in src/app/home/signup/user-not-taken.validator.service.ts(19,21): error TS2322: Type 'void' is not assignable to type 'ObservableInput'.
Np VSCODE recebo a mensagem: Type 'void' is not assignable to type 'ObservableInput'.ts(2322) switchMap.d.ts(2, 79): The expected type comes from the return type of this signature.
Estou usando as seguintes versões: Angular CLI: 8.0.6 Node: 10.16.0 OS: win32 x64 Angular: 8.0.3 ... animations, common, compiler, compiler-cli, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router
Package Version
@angular-devkit/architect 0.800.6 @angular-devkit/build-angular 0.800.6 @angular-devkit/build-optimizer 0.800.6 @angular-devkit/build-webpack 0.800.6 @angular-devkit/core 8.0.6 @angular-devkit/schematics 8.0.6 @angular/cli 8.0.6 @ngtools/webpack 8.0.6 @schematics/angular 8.0.6 @schematics/update 0.800.6 rxjs 6.4.0 typescript 3.4.5 webpack 4.30.0
Pode ser algo relacionado a versão mais atual do Angular?
import { Injectable } from '@angular/core';
import { AbstractControl } from '@angular/forms';
import { debounceTime, switchMap, map, first } from 'rxjs/operators';
import { SignUpService } from './signup.service';
@Injectable({ providedIn: 'root'})
export class UserNotTakenValidatorService {
constructor(private signUpService: SignUpService) {}
checkUserNameTaken() {
return (control: AbstractControl) => {
return control
.valueChanges
.pipe(debounceTime(300))
.pipe(switchMap(userName =>
this.signUpService.checkUserNameTaken(userName)
))
.pipe(map(isTaken => isTaken ? { userNameTaken: true } : null))
.pipe(first());
}
}