diff --git a/.changeset/chilled-cherries-sin.md b/.changeset/chilled-cherries-sin.md new file mode 100644 index 000000000000..7937842ab782 --- /dev/null +++ b/.changeset/chilled-cherries-sin.md @@ -0,0 +1,9 @@ +--- +"@refinedev/core": patch +--- + +fix(core): fixed type issue in useSelect. #6223 + +Previously, the types would not allow functions to be passed as props. After this change, it will be possible. + +[Resolves #6223](https://github.com/refinedev/refine/issues/6223) diff --git a/packages/core/src/hooks/useSelect/index.ts b/packages/core/src/hooks/useSelect/index.ts index b9ee27f4c828..288042e8c44d 100644 --- a/packages/core/src/hooks/useSelect/index.ts +++ b/packages/core/src/hooks/useSelect/index.ts @@ -45,16 +45,16 @@ export type UseSelectProps = { * Set the option's label value * @default `"title"` */ - optionLabel?: keyof TData extends string - ? keyof TData - : never | ((item: TData) => string); + optionLabel?: + | (keyof TData extends string ? keyof TData : never) + | ((item: TData) => string); /** * Set the option's value * @default `"id"` */ - optionValue?: keyof TData extends string - ? keyof TData - : never | ((item: TData) => string); + optionValue?: + | (keyof TData extends string ? keyof TData : never) + | ((item: TData) => string); /** * Field name to search for. * @description If provided `optionLabel` is a string, uses `optionLabel`'s value.