@mobx-ecosystem/mobx-form 2.3.21 → 2.3.23

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.
@@ -1,5 +1,5 @@
1
1
  import { FieldService } from './field-service';
2
- import { FormErrors, FormValues } from 'types';
2
+ import { FormErrors, FormValues } from './types';
3
3
  export declare class FormService<T extends Record<string, FieldService<unknown> | Record<string, unknown>>> {
4
4
  fields: T;
5
5
  validationSchema?: unknown;
@@ -31,7 +31,7 @@ export declare class FormService<T extends Record<string, FieldService<unknown>
31
31
  *
32
32
  * @returns Object of field values
33
33
  */
34
- getValues: () => FormValues<this>;
34
+ getValues: () => FormValues<T>;
35
35
  private getValue;
36
36
  /**
37
37
  * Set fields by this
@@ -42,11 +42,11 @@ export declare class FormService<T extends Record<string, FieldService<unknown>
42
42
  /**
43
43
  * Set object to init values by form service keys
44
44
  */
45
- setInitValues: (values: FormValues<this>) => void;
45
+ setInitValues: (values: FormValues<T>) => void;
46
46
  /**
47
47
  * Set object to values by form service keys
48
48
  */
49
- setValues: (values: FormValues<this>) => void;
49
+ setValues: (values: FormValues<T>) => void;
50
50
  /**
51
51
  * Set field errors to undefined
52
52
  */
@@ -55,7 +55,7 @@ export declare class FormService<T extends Record<string, FieldService<unknown>
55
55
  * Set errors for fields
56
56
  * @param errors object of string which provides errors for fields
57
57
  */
58
- setErrors(error: FormErrors<this>): void;
58
+ setErrors(error: FormErrors<T>): void;
59
59
  /**
60
60
  * Set field values to init values
61
61
  */
package/dist/types.d.ts CHANGED
@@ -1,18 +1,7 @@
1
1
  import { FieldService } from "field-service";
2
- type RecursiveFormValues<Type> = Type extends FieldService<unknown> ? Type['value'] : {
3
- -readonly [Property in keyof Type]: RecursiveFormValues<Type[Property]>;
2
+ export type FormValues<Type> = Type extends FieldService<unknown> ? Type['value'] : {
3
+ -readonly [Property in keyof Type]: FormValues<Type[Property]>;
4
4
  };
5
- type RecursiveFormErrors<Type> = Type extends FieldService<unknown> ? Type['error'] : {
6
- -readonly [Property in keyof Type]: RecursiveFormValues<Type[Property]>;
5
+ export type FormErrors<Type> = Type extends FieldService<unknown> ? Type['error'] : {
6
+ -readonly [Property in keyof Type]: FormErrors<Type[Property]>;
7
7
  };
8
- export type FormValues<Type extends {
9
- fields: Record<string, unknown>;
10
- }> = {
11
- -readonly [Property in keyof Type['fields']]: RecursiveFormValues<Type['fields'][Property]>;
12
- };
13
- export type FormErrors<Type extends {
14
- fields: Record<string, unknown>;
15
- }> = {
16
- -readonly [Property in keyof Type['fields']]: RecursiveFormErrors<Type['fields'][Property]>;
17
- };
18
- export {};
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "type": "module",
3
3
  "name": "@mobx-ecosystem/mobx-form",
4
4
  "private": false,
5
- "version": "2.3.21",
5
+ "version": "2.3.23",
6
6
  "description": "provides the ability to use forms with validation in MobX stores",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",