]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: comments
authorEduardo San Martin Morote <posva13@gmail.com>
Fri, 6 Dec 2024 09:03:39 +0000 (10:03 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Fri, 6 Dec 2024 09:03:39 +0000 (10:03 +0100)
packages/router/src/new-route-resolver/matcher-location.ts
packages/router/src/new-route-resolver/matchers/errors.ts
packages/router/tsconfig.json

index bb44326b2e689ed6660ebafa42f31141bbad026d..1bfcd9a164b9ce28ac9bf63fe6cd3bf8dcd50c97 100644 (file)
@@ -1,7 +1,9 @@
 import type { LocationQueryRaw } from '../query'
 import type { MatcherName } from './matcher'
 
-// the matcher can serialize and deserialize params
+/**
+ * Generic object of params that can be passed to a matcher.
+ */
 export type MatcherParamsFormatted = Record<string, unknown>
 
 export interface MatcherLocationAsName {
@@ -10,6 +12,9 @@ export interface MatcherLocationAsName {
   query?: LocationQueryRaw
   hash?: string
 
+  /**
+   * A path is ignored if `name` is provided.
+   */
   path?: undefined
 }
 
index 51c5574a8ca3a75d391f1ed3567fdfbde18fd167..4ad69cc4ca11e68f94fd6cf2cb5d1229c30ca68c 100644 (file)
@@ -1,9 +1,20 @@
+/**
+ * NOTE: for these classes to keep the same code we need to tell TS with `"useDefineForClassFields": true` in the `tsconfig.json`
+ */
+
+/**
+ * Error throw when a matcher miss
+ */
 export class MatchMiss extends Error {
   name = 'MatchMiss'
 }
 
+// NOTE: not sure about having a helper. Using `new MatchMiss(description?)` is good enough
 export const miss = () => new MatchMiss()
 
+/**
+ * Error throw when a param is invalid when parsing params from path, query, or hash.
+ */
 export class ParamInvalid extends Error {
   name = 'ParamInvalid'
   constructor(public param: string) {
index 41fc6c37882812ee6833e8aefe781935b573ecf5..318f5c6585a40da8bad54844e13c27894e588692 100644 (file)
     "noImplicitReturns": true,
     "strict": true,
     "skipLibCheck": true,
+    "useDefineForClassFields": true,
     // "noUncheckedIndexedAccess": true,
     "experimentalDecorators": true,
     "resolveJsonModule": true,
     "esModuleInterop": true,
     "removeComments": false,
     "jsx": "preserve",
-    "lib": [
-      "esnext",
-      "dom"
-    ],
-    "types": [
-      "node",
-      "vite/client"
-    ]
+    "lib": ["esnext", "dom"],
+    "types": ["node", "vite/client"]
   }
 }