Skip to content

Commit

Permalink
Merge pull request #5082 from Methuselah96/load-options-prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Rall3n committed Feb 28, 2022
2 parents e2327f8 + 7184d53 commit 2d3d6af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/serious-cheetahs-give.md
@@ -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
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

0 comments on commit 2d3d6af

Please sign in to comment.