@conform-to/dom 0.4.0 → 0.4.1
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/index.d.ts +6 -6
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type Primitive = null | undefined | string | number | boolean | Date;
|
|
2
2
|
export declare type FieldElement = HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement | HTMLButtonElement;
|
|
3
|
-
export interface FieldConfig<Schema = unknown> extends FieldConstraint {
|
|
3
|
+
export interface FieldConfig<Schema = unknown> extends FieldConstraint<Schema> {
|
|
4
4
|
name: string;
|
|
5
5
|
defaultValue?: FieldValue<Schema>;
|
|
6
6
|
initialError?: Array<[string, string]>;
|
|
@@ -9,18 +9,18 @@ export interface FieldConfig<Schema = unknown> extends FieldConstraint {
|
|
|
9
9
|
export declare type FieldValue<Schema> = Schema extends Primitive | File ? string : Schema extends Array<infer InnerType> ? Array<FieldValue<InnerType>> : Schema extends Record<string, any> ? {
|
|
10
10
|
[Key in keyof Schema]?: FieldValue<Schema[Key]>;
|
|
11
11
|
} : unknown;
|
|
12
|
-
export declare type FieldConstraint = {
|
|
12
|
+
export declare type FieldConstraint<Schema = any> = {
|
|
13
13
|
required?: boolean;
|
|
14
14
|
minLength?: number;
|
|
15
15
|
maxLength?: number;
|
|
16
|
-
min?:
|
|
17
|
-
max?:
|
|
18
|
-
step?: string;
|
|
16
|
+
min?: Schema extends number ? number : string;
|
|
17
|
+
max?: Schema extends number ? number : string;
|
|
18
|
+
step?: Schema extends number ? number : string;
|
|
19
19
|
multiple?: boolean;
|
|
20
20
|
pattern?: string;
|
|
21
21
|
};
|
|
22
22
|
export declare type FieldsetConstraint<Schema extends Record<string, any>> = {
|
|
23
|
-
[Key in keyof Schema]?: FieldConstraint
|
|
23
|
+
[Key in keyof Schema]?: FieldConstraint<Schema[Key]>;
|
|
24
24
|
};
|
|
25
25
|
export declare type Submission<Schema = unknown> = {
|
|
26
26
|
type: string;
|
package/package.json
CHANGED