Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ReactContext<FormValues = Record<string, any>> {

export interface FieldInputProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
> {
name: string;
onBlur: (event?: React.FocusEvent<T>) => void;
Expand All @@ -31,7 +31,7 @@ export interface FieldInputProps<

export interface FieldRenderProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
_FormValues = any,
> {
input: FieldInputProps<FieldValue, T>;
Expand All @@ -58,6 +58,9 @@ export interface FieldRenderProps<
};
}

// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0)
export type FieldMetaState<FieldValue = any> = FieldRenderProps<FieldValue>['meta'];

export interface SubmitEvent {
preventDefault?: () => void;
stopPropagation?: () => void;
Expand Down Expand Up @@ -120,7 +123,7 @@ export interface UseFieldConfig extends UseFieldAutoConfig {

export interface FieldProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
_FormValues = Record<string, any>,
> extends UseFieldConfig,
Omit<RenderableProps<FieldRenderProps<FieldValue, T>>, "children"> {
Expand Down
13 changes: 8 additions & 5 deletions typescript/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export interface ReactContext<FormValues = Record<string, any>> {

export interface FieldInputProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
> {
name: string;
onBlur: (event?: React.FocusEvent<T>) => void;
Expand All @@ -31,7 +31,7 @@ export interface FieldInputProps<

export interface FieldRenderProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
_FormValues = any,
> {
input: FieldInputProps<FieldValue, T>;
Expand All @@ -58,6 +58,9 @@ export interface FieldRenderProps<
};
}

// Re-export FieldMetaState for backwards compatibility (removed in v7.0.0)
export type FieldMetaState<FieldValue = any> = FieldRenderProps<FieldValue>['meta'];

export interface SubmitEvent {
preventDefault?: () => void;
stopPropagation?: () => void;
Expand Down Expand Up @@ -119,7 +122,7 @@ export interface UseFieldConfig extends UseFieldAutoConfig {

export interface FieldProps<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
_FormValues = Record<string, any>,
> extends UseFieldConfig,
Omit<RenderableProps<FieldRenderProps<FieldValue, T>>, "children"> {
Expand All @@ -144,7 +147,7 @@ export interface FormSpyPropsWithForm<FormValues = Record<string, any>>

export const Field: <
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
FormValues = Record<string, any>,
>(
props: FieldProps<FieldValue, T, FormValues>,
Expand All @@ -160,7 +163,7 @@ export const FormSpy: <FormValues = Record<string, any>>(

export function useField<
FieldValue = any,
T extends HTMLElement = HTMLElement,
T = any,
FormValues = Record<string, any>,
>(
name: string,
Expand Down
Loading