]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
chore: comments
authorEduardo San Martin Morote <posva13@gmail.com>
Mon, 23 Dec 2024 10:44:01 +0000 (11:44 +0100)
committerEduardo San Martin Morote <posva13@gmail.com>
Mon, 23 Dec 2024 10:44:01 +0000 (11:44 +0100)
packages/router/src/experimental/router.ts
packages/router/src/new-route-resolver/matcher.ts
packages/router/src/types/index.ts

index ac44da15541b81bdae5d90b11621c489f5d91dac..cc73bc9c38f6fbe8553580025e0990bc8828e335 100644 (file)
@@ -126,8 +126,8 @@ export interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
    * }
    * ```
    */
-
   scrollBehavior?: RouterScrollBehavior
+
   /**
    * Custom implementation to parse a query. See its counterpart,
    * {@link EXPERIMENTAL_RouterOptions_Base.stringifyQuery}.
@@ -145,26 +145,27 @@ export interface EXPERIMENTAL_RouterOptions_Base extends PathParserOptions {
    * })
    * ```
    */
-
   parseQuery?: typeof originalParseQuery
+
   /**
    * Custom implementation to stringify a query object. Should not prepend a leading `?`.
-   * {@link EXPERIMENTAL_RouterOptions_Base.parseQuery | parseQuery} counterpart to handle query parsing.
+   * {@link parseQuery} counterpart to handle query parsing.
    */
 
   stringifyQuery?: typeof originalStringifyQuery
+
   /**
    * Default class applied to active {@link RouterLink}. If none is provided,
    * `router-link-active` will be applied.
    */
-
   linkActiveClass?: string
+
   /**
    * Default class applied to exact active {@link RouterLink}. If none is provided,
    * `router-link-exact-active` will be applied.
    */
-
   linkExactActiveClass?: string
+
   /**
    * Default class applied to non-active {@link RouterLink}. If none is provided,
    * `router-link-inactive` will be applied.
@@ -191,7 +192,7 @@ export interface EXPERIMENTAL_RouterOptions<TRouteRecordRaw, TRouteRecord>
 }
 
 /**
- * Router instance.
+ * Router base instance.
  * @experimental This version is not stable, it's meant to replace {@link Router} in the future.
  */
 export interface EXPERIMENTAL_Router_Base<TRouteRecordRaw, TRouteRecord> {
@@ -1161,7 +1162,6 @@ export function experimental_createRouter(
   }
 
   // Initialization and Errors
-
   let readyHandlers = useCallbacks<_OnReadyCallback>()
   let errorListeners = useCallbacks<_ErrorListener>()
   let ready: boolean
@@ -1206,9 +1206,9 @@ export function experimental_createRouter(
    * only be called once, otherwise does nothing.
    * @param err - optional error
    */
-  function markAsReady<E = any>(err: E): E
-  function markAsReady<E = any>(): void
-  function markAsReady<E = any>(err?: E): E | void {
+  function markAsReady<E = unknown>(err: E): E
+  function markAsReady(): void
+  function markAsReady<E = unknown>(err?: E): E | void {
     if (!ready) {
       // still not ready if an error happened
       ready = !err
index cabb296ef6af2be5a1bff6f06955834d7022b1f7..54ea4cba128e2805ffc69ba792acac989a28465c 100644 (file)
@@ -325,8 +325,6 @@ export function createCompiledMatcher(
           // }
 
           parsedParams = { ...pathParams, ...queryParams, ...hashParams }
-
-          if (parsedParams) break
         } catch (e) {
           // for debugging tests
           // console.log('❌ ERROR matching', e)
index c06643956c85ea4dc2a20b7d7323e3d3e7a7448e..b2f221d18be48388fd87e1512306eb5a41500c1a 100644 (file)
@@ -185,7 +185,7 @@ export type RouteComponent = Component | DefineComponent
  */
 export type RawRouteComponent = RouteComponent | Lazy<RouteComponent>
 
-// TODO: could this be moved to matcher?
+// TODO: could this be moved to matcher? YES, it's on the way
 /**
  * Internal type for common properties among all kind of {@link RouteRecordRaw}.
  */
@@ -278,7 +278,9 @@ export interface RouteRecordSingleView extends _RouteRecordBase {
 }
 
 /**
- * Route Record defining one single component with a nested view.
+ * Route Record defining one single component with a nested view. Differently
+ * from {@link RouteRecordSingleView}, this record has children and allows a
+ * `redirect` option.
  */
 export interface RouteRecordSingleViewWithChildren extends _RouteRecordBase {
   /**