Skip to content

Commit b57cb21

Browse files
committed
chore: comments
1 parent e76d256 commit b57cb21

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

packages/router/src/new-route-resolver/matcher-location.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
import type { LocationQueryRaw } from '../query'
22
import 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+
*/
57
export type MatcherParamsFormatted = Record<string, unknown>
68

79
export 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

packages/router/src/new-route-resolver/matchers/errors.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
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+
*/
18
export class MatchMiss extends Error {
29
name = 'MatchMiss'
310
}
411

12+
// NOTE: not sure about having a helper. Using `new MatchMiss(description?)` is good enough
513
export const miss = () => new MatchMiss()
614

15+
/**
16+
* Error throw when a param is invalid when parsing params from path, query, or hash.
17+
*/
718
export class ParamInvalid extends Error {
819
name = 'ParamInvalid'
920
constructor(public param: string) {

packages/router/tsconfig.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,14 @@
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
}

0 commit comments

Comments
 (0)