Fix Select types

This commit is contained in:
Timothy Armes
2024-10-21 15:19:28 +02:00
parent 96ca7651ab
commit 8db61bc79b
4 changed files with 21 additions and 20 deletions
+1 -2
View File
@@ -15,8 +15,7 @@ import AsyncSelect from "react-select/async";
import { Prettify } from "@/types";
import { Field, GenericFieldProps } from "./Field";
import { classNames } from "./Select";
import { BaseOption } from "./SelectField";
import { BaseOption, classNames } from "./Select";
export type AsyncSelectFieldProps<
TFieldValues extends FieldValues = FieldValues,
+1 -4
View File
@@ -62,10 +62,7 @@ export type SelectProps<
T = string,
D = unknown,
> = Prettify<
Omit<
Props<BaseOption<T, D>, IsMulti, GroupBase<BaseOption<T, D>>>,
"classNames"
> & {
Omit<Props<BaseOption<T, D>, IsMulti>, "classNames"> & {
required?: boolean;
separators?: boolean;
hasError?: boolean;
+1 -8
View File
@@ -10,18 +10,11 @@ import {
} from "react-hook-form";
import { GroupBase, OnChangeValue } from "react-select";
import { Select, SelectProps } from "@/components/form/Select";
import { BaseOption, Select, SelectProps } from "@/components/form/Select";
import { Prettify } from "@/types";
import { Field, GenericFieldProps } from "./Field";
export type BaseOption<T = string, D = unknown> = {
value: T;
label: string | JSX.Element;
disabled?: boolean;
data?: D;
};
export type SelectFieldProps<
TFieldValues extends FieldValues = FieldValues,
TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,