🐞 Bug report
Command (mark with an x)
Is this a regression?
Probably not
Description
generating a guard with canLoad() method creates it with a wrong return type.
🔬 Minimal Reproduction
ng g guard auth/test --implements CanLoad
🔥 Exception or Error
🌍 Your Environment
@angular-devkit/architect 0.1000.8
@angular-devkit/build-angular 0.1000.8
@angular-devkit/build-optimizer 0.1000.8
@angular-devkit/build-webpack 0.1000.8
@angular-devkit/core 10.0.8
@angular-devkit/schematics 10.0.8
@angular/cdk 10.2.0
@angular/cli 10.0.8
@angular/material 10.2.0
@ngtools/webpack 10.0.8
@schematics/angular 10.0.8
@schematics/update 0.1000.8
rxjs 6.5.5
typescript 3.9.7
webpack 4.43.0
Anything else relevant?
The generated class:
export class TestGuard implements CanLoad {
canLoad(
route: Route,
segments: UrlSegment[]): Observable<boolean> | Promise<boolean> | boolean {
return true;
}
}
Should be:
export class TestGuard implements CanLoad {
canLoad(
route: Route,
segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree {
return true;
}
}
The return type is not correct, according to angular docs | UrlTree is missing
🐞 Bug report
Command (mark with an
x)Is this a regression?
Probably notDescription
generating a guard with canLoad() method creates it with a wrong return type.🔬 Minimal Reproduction
ng g guard auth/test --implements CanLoad🔥 Exception or Error
🌍 Your Environment
Anything else relevant?
The generated class:
Should be:
}
The return type is not correct, according to angular docs
| UrlTreeis missing