Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 7 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,10 @@ export interface FieldRenderProps<
};
}

// Re-export of FieldMetaState for backwards compatibility
// (removed from original sources in v7.0.0 but re-exported here)
export type FieldMetaState<FieldValue = any> = FieldRenderProps<FieldValue>['meta'];

export interface SubmitEvent {
preventDefault?: () => void;
stopPropagation?: () => void;
Expand Down Expand Up @@ -120,7 +124,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
14 changes: 9 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,10 @@ export interface FieldRenderProps<
};
}

// Re-export of FieldMetaState for backwards compatibility
// (removed from original sources in v7.0.0 but re-exported here)
export type FieldMetaState<FieldValue = any> = FieldRenderProps<FieldValue>['meta'];

export interface SubmitEvent {
preventDefault?: () => void;
stopPropagation?: () => void;
Expand Down Expand Up @@ -119,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 All @@ -144,7 +148,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 +164,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