angular-typed-router 0.1.1-0 → 0.1.1-1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +5 -5
  2. package/index.d.ts +5 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -49,6 +49,11 @@ declare module 'angular-typed-router' {
49
49
  interface UserTypedRoutes {
50
50
  routes: typeof appRoutes;
51
51
  }
52
+ // Customize route param types here
53
+ interface AllowedRouteParamValues {
54
+ ids: `${number}`;
55
+ // other params...
56
+ }
52
57
  }
53
58
  ```
54
59
 
@@ -177,8 +182,6 @@ Keep the augmentation in a `.d.ts` that is included by `tsconfig.app.json` (`inc
177
182
 
178
183
  | Concern | Status / Rationale |
179
184
  |---------|---------------------------------------------------------------------------------------|
180
- | Restrict param values (non-empty) | Not enforced; doing so significantly worsens DX (would reject plain `string` vars). |
181
- | Trailing slashes | Not generated unless authored; currently no auto-normalization. |
182
185
  | `relativeTo` (relative navigation) | Not supported – all inferred `Path` / `Commands` are absolute. Use absolute commands. |
183
186
 
184
187
 
@@ -186,15 +189,12 @@ Keep the augmentation in a `.d.ts` that is included by `tsconfig.app.json` (`inc
186
189
 
187
190
  You can use `angular-typed-router-eslint` plugin to forbid untyped navigation calls.
188
191
 
189
- ```bash
190
-
191
192
  ## Troubleshooting
192
193
 
193
194
  | Symptom | Fix |
194
195
  |---------|-----|
195
196
  | `Path` is `never` | Check augmentation file is included in tsconfig. |
196
197
  | Lazy children missing | Ensure promise resolves to `Route[]` or `{ routes: Route[] }`. |
197
- | Template error: unknown routerLink type | Ensure `TypedRouterLink` directive is imported (standalone). |
198
198
 
199
199
  ## Contributing
200
200
 
package/index.d.ts CHANGED
@@ -16,8 +16,10 @@ declare const __rootCatchAll: unique symbol;
16
16
  type RootCatchAll = string & {
17
17
  readonly [__rootCatchAll]: true;
18
18
  };
19
- type AllowedRouteParamValue<S extends string> = Exclude<S, '' | `${string}/${string}`>;
20
- type _ReplaceParams<S extends string> = S extends `${infer Start}:${string}/${infer Rest}` ? `${Start}${AllowedRouteParamValue<string>}/${_ReplaceParams<Rest>}` : S extends `${infer Start}:${string}` ? `${Start}${AllowedRouteParamValue<string>}` : S extends `${infer Start}**/${infer Rest}` ? `${Start}${string}/${_ReplaceParams<Rest>}` : S extends `${infer Start}**` ? Start extends '' ? RootCatchAll : `${Start}${string}` : S;
19
+ interface AllowedRouteParamValues {
20
+ }
21
+ type AllowedRouteParamValue = AllowedRouteParamValues[keyof AllowedRouteParamValues];
22
+ type _ReplaceParams<S extends string> = S extends `${infer Start}:${string}/${infer Rest}` ? `${Start}${AllowedRouteParamValue}/${_ReplaceParams<Rest>}` : S extends `${infer Start}:${string}` ? `${Start}${AllowedRouteParamValue}` : S extends `${infer Start}**/${infer Rest}` ? `${Start}${string}/${_ReplaceParams<Rest>}` : S extends `${infer Start}**` ? Start extends '' ? RootCatchAll : `${Start}${string}` : S;
21
23
  type ReplaceParams<S extends string> = _ReplaceParams<S>;
22
24
 
23
25
  type PathOrEmptyString<R extends Route> = R['path'] extends string ? R['path'] : '';
@@ -63,4 +65,4 @@ declare class TypedRouterLink extends RouterLink {
63
65
  }
64
66
 
65
67
  export { TypedRouter, TypedRouterLink };
66
- export type { Commands, ExtractPathsFromRoutes, Path, UserTypedRoutes };
68
+ export type { AllowedRouteParamValues, Commands, ExtractPathsFromRoutes, Path, UserTypedRoutes };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "angular-typed-router",
3
- "version": "0.1.1-0",
3
+ "version": "0.1.1-1",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^20.2.0",
6
6
  "@angular/core": "^20.2.0"