mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
fix(router): Expose CanMatchFn as public API (#46394)
The `CanMatchFn` is already exposed in the type signature for `canMatch` on the `Route`. This function type should already be exposed as public API but was missed in the initial implementation because the older guards use the `any` type instead. PR Close #46394
This commit is contained in:
parent
ce20ed067f
commit
f94c6f433d
4 changed files with 12 additions and 2 deletions
|
|
@ -141,6 +141,9 @@ export interface CanMatch {
|
|||
canMatch(route: Route, segments: UrlSegment[]): Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean | UrlTree;
|
||||
}
|
||||
|
||||
// @public
|
||||
export type CanMatchFn = (route: Route, segments: UrlSegment[]) => Observable<boolean | UrlTree> | Promise<boolean | UrlTree> | boolean;
|
||||
|
||||
// @public
|
||||
export class ChildActivationEnd {
|
||||
constructor(
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ export {RouterLink, RouterLinkWithHref} from './directives/router_link';
|
|||
export {RouterLinkActive} from './directives/router_link_active';
|
||||
export {RouterOutlet, RouterOutletContract} from './directives/router_outlet';
|
||||
export {ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, Event, EventType, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouterEvent, RoutesRecognized, Scroll} from './events';
|
||||
export {CanActivate, CanActivateChild, CanDeactivate, CanLoad, CanMatch, Data, LoadChildren, LoadChildrenCallback, QueryParamsHandling, Resolve, ResolveData, Route, Routes, RunGuardsAndResolvers, UrlMatcher, UrlMatchResult} from './models';
|
||||
export {CanActivate, CanActivateChild, CanDeactivate, CanLoad, CanMatch, CanMatchFn, Data, LoadChildren, LoadChildrenCallback, QueryParamsHandling, Resolve, ResolveData, Route, Routes, RunGuardsAndResolvers, UrlMatcher, UrlMatchResult} from './models';
|
||||
export {DefaultTitleStrategy, TitleStrategy} from './page_title_strategy';
|
||||
export {BaseRouteReuseStrategy, DetachedRouteHandle, RouteReuseStrategy} from './route_reuse_strategy';
|
||||
export {Navigation, NavigationBehaviorOptions, NavigationExtras, Router, UrlCreationOptions} from './router';
|
||||
|
|
|
|||
|
|
@ -907,6 +907,13 @@ export interface CanMatch {
|
|||
Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean|UrlTree;
|
||||
}
|
||||
|
||||
/**
|
||||
* The signature of a function used as a `CanMatch` guard on a `Route`.
|
||||
*
|
||||
* @publicApi
|
||||
* @see `CanMatch`
|
||||
* @see `Route`
|
||||
*/
|
||||
export type CanMatchFn = (route: Route, segments: UrlSegment[]) =>
|
||||
Observable<boolean|UrlTree>|Promise<boolean|UrlTree>|boolean;
|
||||
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@ describe('applyRedirects', () => {
|
|||
throw 'Should not be reached';
|
||||
}
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('lazy loading', () => {
|
||||
it('should load config on demand', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue