-
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: replace external
StrictRouteParams
with simple type (#325)
Closes #327. ### Refactors - Rename `StrictRouteParams` to `InternalStrictRouteParams` and use it internally to enforce compatibility with Angular's `Params` type - Replace the exposed `StrictRouteParams` with a simple type
- Loading branch information
Showing
5 changed files
with
22 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/router-component-store/src/lib/internal-strict-route-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Params } from '@angular/router'; | ||
import { StrictNoAny } from './util-types/strict-no-any'; | ||
|
||
/** | ||
* @remarks We use this type to ensure compatibility with {@link Params}. | ||
* @internal | ||
*/ | ||
export type InternalStrictRouteParams = Readonly< | ||
StrictNoAny<Params, string | undefined> | ||
>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
packages/router-component-store/src/lib/strict-route-params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
import { Params } from '@angular/router'; | ||
import { StrictNoAny } from './util-types/strict-no-any'; | ||
|
||
/** | ||
* Strict route {@link Params} with read-only members where the `any` member | ||
* type is converted to `string | undefined`. | ||
*/ | ||
export type StrictRouteParams = Readonly< | ||
StrictNoAny<Params, string | undefined> | ||
>; | ||
export interface StrictRouteParams { | ||
readonly [param: string]: string | undefined; | ||
} |