From 42c984993a25189bc1cdc7abdf7f49970f8f0fa0 Mon Sep 17 00:00:00 2001 From: Eduardo San Martin Morote Date: Mon, 23 Dec 2024 11:44:01 +0100 Subject: [PATCH] chore: comments --- packages/router/src/experimental/router.ts | 20 +++++++++---------- .../router/src/new-route-resolver/matcher.ts | 2 -- packages/router/src/types/index.ts | 6 ++++-- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/packages/router/src/experimental/router.ts b/packages/router/src/experimental/router.ts index ac44da15..cc73bc9c 100644 --- a/packages/router/src/experimental/router.ts +++ b/packages/router/src/experimental/router.ts @@ -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 } /** - * 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 { @@ -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(err: E): E - function markAsReady(): void - function markAsReady(err?: E): E | void { + function markAsReady(err: E): E + function markAsReady(): void + function markAsReady(err?: E): E | void { if (!ready) { // still not ready if an error happened ready = !err diff --git a/packages/router/src/new-route-resolver/matcher.ts b/packages/router/src/new-route-resolver/matcher.ts index cabb296e..54ea4cba 100644 --- a/packages/router/src/new-route-resolver/matcher.ts +++ b/packages/router/src/new-route-resolver/matcher.ts @@ -325,8 +325,6 @@ export function createCompiledMatcher( // } parsedParams = { ...pathParams, ...queryParams, ...hashParams } - - if (parsedParams) break } catch (e) { // for debugging tests // console.log('❌ ERROR matching', e) diff --git a/packages/router/src/types/index.ts b/packages/router/src/types/index.ts index c0664395..b2f221d1 100644 --- a/packages/router/src/types/index.ts +++ b/packages/router/src/types/index.ts @@ -185,7 +185,7 @@ export type RouteComponent = Component | DefineComponent */ export type RawRouteComponent = RouteComponent | Lazy -// 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 { /** -- 2.47.2