nuxt-typed-router 2.2.2-beta.0 → 2.2.2-beta.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.
- package/dist/module.d.ts +35 -7
- package/dist/module.json +1 -1
- package/dist/module.mjs +4 -4
- package/package.json +1 -1
package/dist/module.d.ts
CHANGED
|
@@ -7,26 +7,54 @@ interface ModuleOptions {
|
|
|
7
7
|
*/
|
|
8
8
|
plugin?: boolean;
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
10
|
+
* Customise Route location arguments strictness for `NuxtLink` or `router`
|
|
11
|
+
* All strict options are disabled by default.
|
|
12
|
+
* You can tweak options to add strict router navigation options.
|
|
13
|
+
*
|
|
14
|
+
* By passing `true` you can enable all of them
|
|
12
15
|
*
|
|
13
|
-
* ```ts
|
|
14
|
-
* router.push('/login'); // Error ❌
|
|
15
|
-
* ```
|
|
16
16
|
* @default false
|
|
17
17
|
*/
|
|
18
18
|
strict?: boolean | StrictOptions;
|
|
19
19
|
}
|
|
20
20
|
interface StrictOptions {
|
|
21
|
-
NuxtLink
|
|
22
|
-
router
|
|
21
|
+
NuxtLink?: StrictParamsOptions;
|
|
22
|
+
router?: StrictParamsOptions;
|
|
23
23
|
}
|
|
24
24
|
interface StrictParamsOptions {
|
|
25
25
|
/**
|
|
26
|
+
* Prevent passing string path to the RouteLocation argument.
|
|
27
|
+
*
|
|
28
|
+
* Ex:
|
|
29
|
+
* ```vue
|
|
30
|
+
* <template>
|
|
31
|
+
* <NuxtLink to='/login'/> // Error ❌
|
|
32
|
+
* </template>
|
|
33
|
+
* ```
|
|
34
|
+
* Or
|
|
35
|
+
* ```ts
|
|
36
|
+
* router.push('/login'); // Error ❌
|
|
37
|
+
* navigateTo('/login'); // Error ❌
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
26
40
|
* @default false
|
|
27
41
|
*/
|
|
28
42
|
strictToArgument?: boolean;
|
|
29
43
|
/**
|
|
44
|
+
* Prevent passing a `params` property in the RouteLocation argument.
|
|
45
|
+
*
|
|
46
|
+
* Ex:
|
|
47
|
+
* ```vue
|
|
48
|
+
* <template>
|
|
49
|
+
* <NuxtLink :to='{path: "/login"}'/> // Error ❌
|
|
50
|
+
* </template>
|
|
51
|
+
* ```
|
|
52
|
+
* Or
|
|
53
|
+
* ```ts
|
|
54
|
+
* router.push({path: "/login"}); // Error ❌
|
|
55
|
+
* navigateTo({path: "/login"}); // Error ❌
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
30
58
|
* @default false
|
|
31
59
|
*/
|
|
32
60
|
strictRouteLocation?: boolean;
|
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -228,10 +228,10 @@ function createTypedRouterFile() {
|
|
|
228
228
|
* */
|
|
229
229
|
export type TypedRouteLocationRaw =
|
|
230
230
|
| (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params' ${returnIfTrue(
|
|
231
|
-
strictOptions.
|
|
231
|
+
strictOptions.router.strictRouteLocation,
|
|
232
232
|
`| 'path'`
|
|
233
233
|
)}> & RoutesNamedLocations)
|
|
234
|
-
${returnIfFalse(strictOptions.
|
|
234
|
+
${returnIfFalse(strictOptions.router.strictToArgument, "| string")};
|
|
235
235
|
|
|
236
236
|
|
|
237
237
|
/**
|
|
@@ -239,10 +239,10 @@ function createTypedRouterFile() {
|
|
|
239
239
|
*/
|
|
240
240
|
export type TypedRouteLocationRawFromName<T extends RoutesNamesList> =
|
|
241
241
|
| (Omit<Exclude<RouteLocationRaw, string>, 'name' | 'params' ${returnIfTrue(
|
|
242
|
-
strictOptions.
|
|
242
|
+
strictOptions.router.strictRouteLocation,
|
|
243
243
|
`| 'path'`
|
|
244
244
|
)}> & TypedLocationAsRelativeRaw<T>)
|
|
245
|
-
${returnIfFalse(strictOptions.
|
|
245
|
+
${returnIfFalse(strictOptions.router.strictToArgument, "| string")};
|
|
246
246
|
|
|
247
247
|
/**
|
|
248
248
|
* Generic providing inference and dynamic inclusion of \`params\` property
|