@shopify/react-form-state
Advanced tools
Comparing version 2.0.4 to 2.1.0
@@ -8,3 +8,3 @@ import React from 'react'; | ||
} | ||
export default class List<Fields> extends React.PureComponent<Props<Fields>, never> { | ||
export default class List<Fields extends object> extends React.PureComponent<Props<Fields>, never> { | ||
private changeHandlers; | ||
@@ -11,0 +11,0 @@ render(): JSX.Element[]; |
@@ -7,3 +7,3 @@ import React from 'react'; | ||
} | ||
export default class Nested<Fields> extends React.PureComponent<Props<Fields>, never> { | ||
export default class Nested<Fields extends object> extends React.PureComponent<Props<Fields>, never> { | ||
private changeHandlers; | ||
@@ -10,0 +10,0 @@ render(): React.ReactNode; |
@@ -8,9 +8,9 @@ import React from 'react'; | ||
} | ||
declare type MaybeArray<T> = T | T[]; | ||
declare type MaybePromise<T> = T | Promise<T>; | ||
type MaybeArray<T> = T | T[]; | ||
type MaybePromise<T> = T | Promise<T>; | ||
interface SubmitHandler<Fields> { | ||
(formDetails: FormData<Fields>): MaybePromise<RemoteError[]> | MaybePromise<void> | MaybePromise<RemoteError[] | void>; | ||
} | ||
export declare type Validator<T, F> = MaybeArray<ValidationFunction<T, F>>; | ||
export declare type ValidatorDictionary<FieldMap> = { | ||
export type Validator<T, F> = MaybeArray<ValidationFunction<T, F>>; | ||
export type ValidatorDictionary<FieldMap> = { | ||
[FieldPath in keyof FieldMap]: Validator<FieldMap[FieldPath], FieldMap>; | ||
@@ -48,3 +48,3 @@ }; | ||
static Nested: typeof Nested; | ||
static getDerivedStateFromProps<T>(newProps: Props<T>, oldState: State<T>): { | ||
static getDerivedStateFromProps<T extends object>(newProps: Props<T>, oldState: State<T>): { | ||
externalErrors: RemoteError[]; | ||
@@ -51,0 +51,0 @@ fields: FieldStates<T>; |
@@ -16,3 +16,3 @@ export interface FieldState<Value> { | ||
} | ||
export declare type FieldDescriptors<Fields> = { | ||
export type FieldDescriptors<Fields> = { | ||
[FieldPath in keyof Fields]: FieldDescriptor<Fields[FieldPath]>; | ||
@@ -23,3 +23,3 @@ }; | ||
} | ||
export declare type FieldStates<Fields> = { | ||
export type FieldStates<Fields> = { | ||
[FieldPath in keyof Fields]: FieldState<Fields[FieldPath]>; | ||
@@ -26,0 +26,0 @@ }; |
import isEqual from 'fast-deep-equal'; | ||
import { FieldDescriptor } from './types'; | ||
export { isEqual }; | ||
export declare function mapObject<Input, Output>(input: Input, mapper: (value: any, key: string & keyof Input) => any): Output; | ||
export declare function mapObject<Input extends object, Output>(input: Input, mapper: (value: any, key: string & keyof Input) => any): Output; | ||
export declare function push<T>(array: T[], ...values: T[]): T[]; | ||
@@ -24,3 +24,3 @@ export declare function remove<T>(array: T[], targetIndex: number): T[]; | ||
}; | ||
export declare type ChoiceFieldDescriptor = ReturnType<typeof asChoiceField>; | ||
export type ChoiceFieldDescriptor = ReturnType<typeof asChoiceField>; | ||
//# sourceMappingURL=utilities.d.ts.map |
@@ -5,3 +5,3 @@ import { StringMapper } from './types'; | ||
} | ||
declare type ErrorContent = string | StringMapper; | ||
type ErrorContent = string | StringMapper; | ||
export declare function validateNested<Input extends object, Fields>(validatorDictionary: any): (input: Input, fields: Fields) => any; | ||
@@ -8,0 +8,0 @@ export declare function validateList<Input extends object, Fields>(validatorDictionary: any): (input: Input[], fields: Fields) => any[] | undefined; |
{ | ||
"name": "@shopify/react-form-state", | ||
"version": "2.0.4", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -33,3 +33,3 @@ "description": "Manage React forms tersely and type-safely with no magic", | ||
"devDependencies": { | ||
"@shopify/react-testing": "^4.2.2" | ||
"@shopify/react-testing": "^5.1.0" | ||
}, | ||
@@ -36,0 +36,0 @@ "sideEffects": false, |
@@ -14,3 +14,3 @@ # `@shopify/react-form-state` | ||
```bash | ||
$ yarn add @shopify/react-form-state | ||
yarn add @shopify/react-form-state | ||
``` | ||
@@ -17,0 +17,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77443