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 11import type { LocationQueryRaw } from '../query'
22import type { MatcherName } from './matcher'
33
4- // the matcher can serialize and deserialize params
4+ /**
5+ * Generic object of params that can be passed to a matcher.
6+ */
57export type MatcherParamsFormatted = Record < string , unknown >
68
79export interface MatcherLocationAsName {
@@ -10,6 +12,9 @@ export interface MatcherLocationAsName {
1012 query ?: LocationQueryRaw
1113 hash ?: string
1214
15+ /**
16+ * A path is ignored if `name` is provided.
17+ */
1318 path ?: undefined
1419}
1520
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+ */
18export class MatchMiss extends Error {
29 name = 'MatchMiss'
310}
411
12+ // NOTE: not sure about having a helper. Using `new MatchMiss(description?)` is good enough
513export const miss = ( ) => new MatchMiss ( )
614
15+ /**
16+ * Error throw when a param is invalid when parsing params from path, query, or hash.
17+ */
718export class ParamInvalid extends Error {
819 name = 'ParamInvalid'
920 constructor ( public param : string ) {
Original file line number Diff line number Diff line change 2222 "noImplicitReturns" : true ,
2323 "strict" : true ,
2424 "skipLibCheck" : true ,
25+ "useDefineForClassFields" : true ,
2526 // "noUncheckedIndexedAccess": true,
2627 "experimentalDecorators" : true ,
2728 "resolveJsonModule" : true ,
2829 "esModuleInterop" : true ,
2930 "removeComments" : false ,
3031 "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" ]
3934 }
4035}
You can’t perform that action at this time.
0 commit comments