@conform-to/dom 0.1.0 → 0.1.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 CHANGED
@@ -1,4 +1,4 @@
1
- export declare type Constraint<Type> = (Type extends string | number | Date | undefined ? {
1
+ export declare type Constraint = {
2
2
  required?: boolean;
3
3
  minLength?: number;
4
4
  maxLength?: number;
@@ -7,25 +7,17 @@ export declare type Constraint<Type> = (Type extends string | number | Date | un
7
7
  step?: string;
8
8
  multiple?: boolean;
9
9
  pattern?: string;
10
- } : {}) & (undefined extends Type ? {
11
- required?: false;
12
- } : {
13
- required: true;
14
- }) & (Type extends Array<any> ? {
15
- multiple: true;
16
- } : {
17
- multiple?: false;
18
- });
10
+ };
19
11
  export interface FieldConfig<Type = any> {
20
12
  name: string;
21
13
  initialValue?: FieldsetData<Type, string>;
22
14
  error?: FieldsetData<Type, string>;
23
15
  form?: string;
24
- constraint?: Constraint<Type>;
16
+ constraint?: Constraint;
25
17
  }
26
18
  export declare type Schema<Type extends Record<string, any>> = {
27
19
  fields: {
28
- [Key in keyof Type]-?: Constraint<Type[Key]>;
20
+ [Key in keyof Type]-?: Constraint;
29
21
  };
30
22
  validate?: (element: FieldsetElement) => void;
31
23
  };
package/index.js CHANGED
@@ -63,7 +63,6 @@ function createFieldConfig(schema, options) {
63
63
  form: options.form,
64
64
  initialValue: (_options$initialValue = options.initialValue) === null || _options$initialValue === void 0 ? void 0 : _options$initialValue[key],
65
65
  error: (_options$error = options.error) === null || _options$error === void 0 ? void 0 : _options$error[key],
66
- // @ts-expect-error
67
66
  constraint
68
67
  };
69
68
  result[key] = config;
package/module/index.js CHANGED
@@ -59,7 +59,6 @@ function createFieldConfig(schema, options) {
59
59
  form: options.form,
60
60
  initialValue: (_options$initialValue = options.initialValue) === null || _options$initialValue === void 0 ? void 0 : _options$initialValue[key],
61
61
  error: (_options$error = options.error) === null || _options$error === void 0 ? void 0 : _options$error[key],
62
- // @ts-expect-error
63
62
  constraint
64
63
  };
65
64
  result[key] = config;
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@conform-to/dom",
3
3
  "description": "A set of opinionated helpers built on top of the Constraint Validation API",
4
4
  "license": "MIT",
5
- "version": "0.1.0",
5
+ "version": "0.1.1",
6
6
  "main": "index.js",
7
7
  "module": "module/index.js",
8
8
  "repository": {