File tree Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Expand file tree Collapse file tree 3 files changed +20
-9
lines changed Original file line number Diff line number Diff line change 1
1
import type { LocationQueryRaw } from '../query'
2
2
import type { MatcherName } from './matcher'
3
3
4
- // the matcher can serialize and deserialize params
4
+ /**
5
+ * Generic object of params that can be passed to a matcher.
6
+ */
5
7
export type MatcherParamsFormatted = Record < string , unknown >
6
8
7
9
export interface MatcherLocationAsName {
@@ -10,6 +12,9 @@ export interface MatcherLocationAsName {
10
12
query ?: LocationQueryRaw
11
13
hash ?: string
12
14
15
+ /**
16
+ * A path is ignored if `name` is provided.
17
+ */
13
18
path ?: undefined
14
19
}
15
20
Original file line number Diff line number Diff line change
1
+ /**
2
+ * NOTE: for these classes to keep the same code we need to tell TS with `"useDefineForClassFields": true` in the `tsconfig.json`
3
+ */
4
+
5
+ /**
6
+ * Error throw when a matcher miss
7
+ */
1
8
export class MatchMiss extends Error {
2
9
name = 'MatchMiss'
3
10
}
4
11
12
+ // NOTE: not sure about having a helper. Using `new MatchMiss(description?)` is good enough
5
13
export const miss = ( ) => new MatchMiss ( )
6
14
15
+ /**
16
+ * Error throw when a param is invalid when parsing params from path, query, or hash.
17
+ */
7
18
export class ParamInvalid extends Error {
8
19
name = 'ParamInvalid'
9
20
constructor ( public param : string ) {
Original file line number Diff line number Diff line change 22
22
"noImplicitReturns" : true ,
23
23
"strict" : true ,
24
24
"skipLibCheck" : true ,
25
+ "useDefineForClassFields" : true ,
25
26
// "noUncheckedIndexedAccess": true,
26
27
"experimentalDecorators" : true ,
27
28
"resolveJsonModule" : true ,
28
29
"esModuleInterop" : true ,
29
30
"removeComments" : false ,
30
31
"jsx" : " preserve" ,
31
- "lib" : [
32
- " esnext" ,
33
- " dom"
34
- ],
35
- "types" : [
36
- " node" ,
37
- " vite/client"
38
- ]
32
+ "lib" : [" esnext" , " dom" ],
33
+ "types" : [" node" , " vite/client" ]
39
34
}
40
35
}
You can’t perform that action at this time.
0 commit comments