@kitbag/router 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/kitbag-router.d.ts +8 -10
- package/package.json +1 -1
package/dist/kitbag-router.d.ts
CHANGED
|
@@ -153,7 +153,7 @@ declare type CombinePath<TParent extends Path, TChild extends Path> = ToPath<TPa
|
|
|
153
153
|
} ? ToPath<TChild> extends {
|
|
154
154
|
path: infer TChildPath extends string;
|
|
155
155
|
params: infer TChildParams extends Record<string, unknown>;
|
|
156
|
-
} ? MergeParams<TParentParams
|
|
156
|
+
} ? MergeParams<RemoveLeadingQuestionMarkFromKeys<TParentParams>, RemoveLeadingQuestionMarkFromKeys<TChildParams>> extends PathParamsWithParamNameExtracted<`${TParentPath}${TChildPath}`> ? Path<`${TParentPath}${TChildPath}`, MergeParams<RemoveLeadingQuestionMarkFromKeys<TParentParams>, RemoveLeadingQuestionMarkFromKeys<TChildParams>>> : Path<'', {}> : Path<'', {}> : Path<'', {}>;
|
|
157
157
|
|
|
158
158
|
declare type CombineQuery<TParent extends Query | undefined, TChild extends Query | undefined> = ToQuery<TParent> extends {
|
|
159
159
|
query: infer TParentQuery extends string;
|
|
@@ -161,7 +161,7 @@ declare type CombineQuery<TParent extends Query | undefined, TChild extends Quer
|
|
|
161
161
|
} ? ToQuery<TChild> extends {
|
|
162
162
|
query: infer TChildQuery extends string;
|
|
163
163
|
params: infer TChildParams extends Record<string, unknown>;
|
|
164
|
-
} ? MergeParams<TParentParams
|
|
164
|
+
} ? MergeParams<RemoveLeadingQuestionMarkFromKeys<TParentParams>, RemoveLeadingQuestionMarkFromKeys<TChildParams>> extends QueryParamsWithParamNameExtracted<CombineQueryString<TParentQuery, TChildQuery>> ? Query<CombineQueryString<TParentQuery, TChildQuery>, MergeParams<RemoveLeadingQuestionMarkFromKeys<TParentParams>, RemoveLeadingQuestionMarkFromKeys<TChildParams>>> : Query<'', {}> : Query<'', {}> : Query<'', {}>;
|
|
165
165
|
|
|
166
166
|
declare type CombineQueryString<TParent extends string | undefined, TChild extends string | undefined> = StringHasValue<TParent> extends true ? StringHasValue<TChild> extends true ? `${TParent}&${TChild}` : TParent : TChild;
|
|
167
167
|
|
|
@@ -624,10 +624,6 @@ declare type Path<TPath extends string = string, TParams extends PathParamsWithP
|
|
|
624
624
|
*/
|
|
625
625
|
export declare function path<TPath extends string, TParams extends PathParamsWithParamNameExtracted<TPath>>(path: TPath, params: Identity<TParams>): Path<TPath, TParams>;
|
|
626
626
|
|
|
627
|
-
declare type PathParams<TPath extends string> = {
|
|
628
|
-
[K in keyof ExtractParamsFromPathString<TPath>]?: Param;
|
|
629
|
-
};
|
|
630
|
-
|
|
631
627
|
declare type PathParamsWithParamNameExtracted<TPath extends string> = {
|
|
632
628
|
[K in keyof ExtractParamsFromPathString<TPath> as ExtractParamName<K>]?: Param;
|
|
633
629
|
};
|
|
@@ -667,10 +663,6 @@ declare type Query<TQuery extends string = string, TQueryParams extends QueryPar
|
|
|
667
663
|
*/
|
|
668
664
|
export declare function query<TQuery extends string, TParams extends QueryParamsWithParamNameExtracted<TQuery>>(query: TQuery, params: Identity<TParams>): Query<TQuery, TParams>;
|
|
669
665
|
|
|
670
|
-
declare type QueryParams<T extends string> = {
|
|
671
|
-
[K in keyof ExtractQueryParamsFromQueryString<T>]?: Param;
|
|
672
|
-
};
|
|
673
|
-
|
|
674
666
|
declare type QueryParamsWithParamNameExtracted<T extends string> = {
|
|
675
667
|
[K in keyof ExtractQueryParamsFromQueryString<T> as ExtractParamName<K>]?: Param;
|
|
676
668
|
};
|
|
@@ -744,6 +736,12 @@ export declare type RegisteredRoutes = Register extends {
|
|
|
744
736
|
*/
|
|
745
737
|
export declare type RegisteredRoutesKey = RoutesKey<RegisteredRoutes>;
|
|
746
738
|
|
|
739
|
+
declare type RemoveLeadingQuestionMark<T extends PropertyKey> = T extends `?${infer TRest extends string}` ? TRest : T;
|
|
740
|
+
|
|
741
|
+
declare type RemoveLeadingQuestionMarkFromKeys<T extends Record<string, unknown>> = {
|
|
742
|
+
[K in keyof T as RemoveLeadingQuestionMark<K>]: T[K];
|
|
743
|
+
};
|
|
744
|
+
|
|
747
745
|
/**
|
|
748
746
|
* Represents a route that the router has matched to current browser location.
|
|
749
747
|
* @template TRoute - Underlying Route that has been resolved.
|