Skip to content

Commit

Permalink
fix(core): fixed type issue in useSelect's optionLabel and `optionV…
Browse files Browse the repository at this point in the history
…alue` (#6224)
  • Loading branch information
WananiAdib committed Aug 5, 2024
1 parent cbf2fd7 commit 81703b6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions .changeset/chilled-cherries-sin.md
Original file line number Diff line number Diff line change
@@ -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)
12 changes: 6 additions & 6 deletions packages/core/src/hooks/useSelect/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ export type UseSelectProps<TQueryFnData, TError, TData> = {
* 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.
Expand Down

0 comments on commit 81703b6

Please sign in to comment.