diff --git a/goldens/public-api/router/router.d.ts b/goldens/public-api/router/router.d.ts index 0344691103..054ac19075 100644 --- a/goldens/public-api/router/router.d.ts +++ b/goldens/public-api/router/router.d.ts @@ -376,13 +376,11 @@ export declare class RouterEvent { } export declare class RouterLink implements OnChanges { - fragment: string; + fragment?: string; preserveFragment: boolean; /** @deprecated */ set preserveQueryParams(value: boolean); - queryParams: { - [k: string]: any; - }; - queryParamsHandling: QueryParamsHandling; + queryParams?: Params | null; + queryParamsHandling?: QueryParamsHandling | null; replaceUrl: boolean; set routerLink(commands: any[] | string | null | undefined); skipLocationChange: boolean; @@ -410,14 +408,12 @@ export declare class RouterLinkActive implements OnChanges, OnDestroy, AfterCont } export declare class RouterLinkWithHref implements OnChanges, OnDestroy { - fragment: string; + fragment?: string; href: string; preserveFragment: boolean; /** @deprecated */ set preserveQueryParams(value: boolean); - queryParams: { - [k: string]: any; - }; - queryParamsHandling: QueryParamsHandling; + queryParams?: Params | null; + queryParamsHandling?: QueryParamsHandling | null; replaceUrl: boolean; set routerLink(commands: any[] | string | null | undefined); skipLocationChange: boolean; diff --git a/packages/router/src/directives/router_link.ts b/packages/router/src/directives/router_link.ts index bf8fa089d1..4b6a4129eb 100644 --- a/packages/router/src/directives/router_link.ts +++ b/packages/router/src/directives/router_link.ts @@ -14,6 +14,7 @@ import {QueryParamsHandling} from '../config'; import {Event, NavigationEnd} from '../events'; import {Router} from '../router'; import {ActivatedRoute} from '../router_state'; +import {Params} from '../shared'; import {UrlTree} from '../url_tree'; @@ -122,24 +123,21 @@ export class RouterLink implements OnChanges { * @see {@link UrlCreationOptions#queryParams UrlCreationOptions#queryParams} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() queryParams!: {[k: string]: any}; + @Input() queryParams?: Params|null; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`. * @see {@link UrlCreationOptions#fragment UrlCreationOptions#fragment} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() fragment!: string; + @Input() fragment?: string; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`. * @see {@link UrlCreationOptions#queryParamsHandling UrlCreationOptions#queryParamsHandling} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() queryParamsHandling!: QueryParamsHandling; + @Input() queryParamsHandling?: QueryParamsHandling|null; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`. @@ -264,24 +262,21 @@ export class RouterLinkWithHref implements OnChanges, OnDestroy { * @see {@link UrlCreationOptions#queryParams UrlCreationOptions#queryParams} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() queryParams!: {[k: string]: any}; + @Input() queryParams?: Params|null; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`. * @see {@link UrlCreationOptions#fragment UrlCreationOptions#fragment} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() fragment!: string; + @Input() fragment?: string; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`. * @see {@link UrlCreationOptions#queryParamsHandling UrlCreationOptions#queryParamsHandling} * @see {@link Router#createUrlTree Router#createUrlTree} */ - // TODO(issue/24571): remove '!'. - @Input() queryParamsHandling!: QueryParamsHandling; + @Input() queryParamsHandling?: QueryParamsHandling|null; /** * Passed to {@link Router#createUrlTree Router#createUrlTree} as part of the * `UrlCreationOptions`.