@real-router/types 0.16.0 → 0.17.0

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.
@@ -109,7 +109,6 @@ interface RouterError extends Error {
109
109
  * @see {@link State.meta} for where options are stored after navigation
110
110
  */
111
111
  interface NavigationOptions {
112
- [key: string]: string | number | boolean | Record<string, unknown> | undefined;
113
112
  /**
114
113
  * Replace the current history entry instead of pushing a new one.
115
114
  *
@@ -245,6 +244,17 @@ interface NavigationOptions {
245
244
  * @see {@link NavigationOptions.redirected} for the input mechanism
246
245
  */
247
246
  redirected?: boolean | undefined;
247
+ /**
248
+ * Optional abort signal for cancelling the navigation.
249
+ *
250
+ * @description
251
+ * When provided, this signal can be used to cancel the navigation operation.
252
+ * If the signal is aborted, the navigation will be cancelled and any pending
253
+ * guards or transitions will be interrupted.
254
+ *
255
+ * @default undefined
256
+ */
257
+ signal?: AbortSignal | undefined;
248
258
  }
249
259
  interface Params {
250
260
  [key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
@@ -416,7 +426,7 @@ interface Options {
416
426
  */
417
427
  noValidate?: boolean;
418
428
  }
419
- type GuardFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean>;
429
+ type GuardFn = (toState: State, fromState: State | undefined, signal?: AbortSignal) => boolean | Promise<boolean>;
420
430
  type DefaultDependencies = object;
421
431
  interface Config {
422
432
  decoders: Record<string, (params: Params) => Params>;
@@ -109,7 +109,6 @@ interface RouterError extends Error {
109
109
  * @see {@link State.meta} for where options are stored after navigation
110
110
  */
111
111
  interface NavigationOptions {
112
- [key: string]: string | number | boolean | Record<string, unknown> | undefined;
113
112
  /**
114
113
  * Replace the current history entry instead of pushing a new one.
115
114
  *
@@ -245,6 +244,17 @@ interface NavigationOptions {
245
244
  * @see {@link NavigationOptions.redirected} for the input mechanism
246
245
  */
247
246
  redirected?: boolean | undefined;
247
+ /**
248
+ * Optional abort signal for cancelling the navigation.
249
+ *
250
+ * @description
251
+ * When provided, this signal can be used to cancel the navigation operation.
252
+ * If the signal is aborted, the navigation will be cancelled and any pending
253
+ * guards or transitions will be interrupted.
254
+ *
255
+ * @default undefined
256
+ */
257
+ signal?: AbortSignal | undefined;
248
258
  }
249
259
  interface Params {
250
260
  [key: string]: string | string[] | number | number[] | boolean | boolean[] | Params | Params[] | Record<string, string | number | boolean> | null | undefined;
@@ -416,7 +426,7 @@ interface Options {
416
426
  */
417
427
  noValidate?: boolean;
418
428
  }
419
- type GuardFn = (toState: State, fromState: State | undefined) => boolean | Promise<boolean>;
429
+ type GuardFn = (toState: State, fromState: State | undefined, signal?: AbortSignal) => boolean | Promise<boolean>;
420
430
  type DefaultDependencies = object;
421
431
  interface Config {
422
432
  decoders: Record<string, (params: Params) => Params>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@real-router/types",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "type": "commonjs",
5
5
  "description": "Shared TypeScript types for Real Router ecosystem",
6
6
  "types": "./dist/esm/index.d.mts",
package/src/base.ts CHANGED
@@ -86,13 +86,6 @@ export interface RouterError extends Error {
86
86
  * @see {@link State.meta} for where options are stored after navigation
87
87
  */
88
88
  export interface NavigationOptions {
89
- [key: string]:
90
- | string
91
- | number
92
- | boolean
93
- | Record<string, unknown>
94
- | undefined;
95
-
96
89
  /**
97
90
  * Replace the current history entry instead of pushing a new one.
98
91
  *
@@ -232,6 +225,18 @@ export interface NavigationOptions {
232
225
  * @see {@link NavigationOptions.redirected} for the input mechanism
233
226
  */
234
227
  redirected?: boolean | undefined;
228
+
229
+ /**
230
+ * Optional abort signal for cancelling the navigation.
231
+ *
232
+ * @description
233
+ * When provided, this signal can be used to cancel the navigation operation.
234
+ * If the signal is aborted, the navigation will be cancelled and any pending
235
+ * guards or transitions will be interrupted.
236
+ *
237
+ * @default undefined
238
+ */
239
+ signal?: AbortSignal | undefined;
235
240
  }
236
241
 
237
242
  export interface Params {
package/src/router.ts CHANGED
@@ -158,6 +158,7 @@ export interface Options {
158
158
  export type GuardFn = (
159
159
  toState: State,
160
160
  fromState: State | undefined,
161
+ signal?: AbortSignal,
161
162
  ) => boolean | Promise<boolean>;
162
163
 
163
164
  export type DefaultDependencies = object;