Skip to content

Commit

Permalink
fix(router): correct type of nextState parameter in canDeactivate
Browse files Browse the repository at this point in the history
Correct type of nextState parameter in canDeactivate guard to indicate it's never undefined

Fixes #47153
  • Loading branch information
JeanMeche committed Nov 14, 2022
1 parent 954f700 commit 2b369d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion goldens/public-api/router/index.md
Expand Up @@ -133,7 +133,7 @@ export type CanActivateFn = (route: ActivatedRouteSnapshot, state: RouterStateSn
// @public
export interface CanDeactivate<T> {
// (undocumented)
canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState: RouterStateSnapshot): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
}

// @public
Expand Down
4 changes: 2 additions & 2 deletions packages/router/src/models.ts
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {EnvironmentInjector, EnvironmentProviders, InjectionToken, NgModuleFactory, Provider, ProviderToken, Type} from '@angular/core';
import {EnvironmentInjector, EnvironmentProviders, InjectionToken, NgModuleFactory, Provider, Type} from '@angular/core';
import {Observable} from 'rxjs';

import {DeprecatedLoadChildren} from './deprecated_load_children';
Expand Down Expand Up @@ -851,7 +851,7 @@ export type CanActivateChildFn = (childRoute: ActivatedRouteSnapshot, state: Rou
export interface CanDeactivate<T> {
canDeactivate(
component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot,
nextState?: RouterStateSnapshot): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean
nextState: RouterStateSnapshot): Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean
|UrlTree;
}

Expand Down

0 comments on commit 2b369d9

Please sign in to comment.