@ovineko/react-router 0.0.3 → 0.0.4
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/utils.d.ts +8 -1
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -15,6 +15,12 @@ export declare const filterBySchemaKeys: <T extends v.ObjectSchema<any, any>>(ob
|
|
|
15
15
|
* Required parameters are kept as-is for subsequent validation.
|
|
16
16
|
*/
|
|
17
17
|
export declare const cleanOptionalParams: <T extends v.ObjectSchema<any, any>>(obj: Record<string, unknown>, schema: T) => Record<string, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Utility type to make all entries in an object schema optional.
|
|
20
|
+
*/
|
|
21
|
+
type OptionalEntries<T extends v.ObjectEntries> = {
|
|
22
|
+
[K in keyof T]: v.OptionalSchema<T[K], undefined>;
|
|
23
|
+
};
|
|
18
24
|
/**
|
|
19
25
|
* Wraps all fields in a Valibot object schema with v.optional().
|
|
20
26
|
* Useful for search params where all fields should be optional by default.
|
|
@@ -36,4 +42,5 @@ export declare const cleanOptionalParams: <T extends v.ObjectSchema<any, any>>(o
|
|
|
36
42
|
* })
|
|
37
43
|
* ```
|
|
38
44
|
*/
|
|
39
|
-
export declare const optionalSearchParams: <TEntries extends v.ObjectEntries>(entries: TEntries) => v.ObjectSchema<
|
|
45
|
+
export declare const optionalSearchParams: <const TEntries extends v.ObjectEntries>(entries: TEntries) => v.ObjectSchema<OptionalEntries<TEntries>, undefined>;
|
|
46
|
+
export {};
|