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
5 changes: 5 additions & 0 deletions .changeset/serious-cheetahs-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'react-select': patch
---

Fix type inference for Async's loadOptions prop
10 changes: 4 additions & 6 deletions packages/react-select/src/useAsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ export interface AsyncAdditionalProps<Option, Group extends GroupBase<Option>> {
* Function that returns a promise, which is the set of options to be used
* once the promise resolves.
*/
loadOptions?:
| ((
inputValue: string,
callback: (options: OptionsOrGroups<Option, Group>) => void
) => void)
| ((inputValue: string) => Promise<OptionsOrGroups<Option, Group>>);
loadOptions?: (
inputValue: string,
callback: (options: OptionsOrGroups<Option, Group>) => void
) => Promise<OptionsOrGroups<Option, Group>> | void;
/**
* Will cause the select to be displayed in the loading state, even if the
* Async select is not currently waiting for loadOptions to resolve
Expand Down