diff --git a/.changeset/serious-cheetahs-give.md b/.changeset/serious-cheetahs-give.md new file mode 100644 index 0000000000..98f8702933 --- /dev/null +++ b/.changeset/serious-cheetahs-give.md @@ -0,0 +1,5 @@ +--- +'react-select': patch +--- + +Fix type inference for Async's loadOptions prop diff --git a/packages/react-select/src/useAsync.ts b/packages/react-select/src/useAsync.ts index 328f3a6827..334f66d7f2 100644 --- a/packages/react-select/src/useAsync.ts +++ b/packages/react-select/src/useAsync.ts @@ -24,12 +24,10 @@ export interface AsyncAdditionalProps> { * Function that returns a promise, which is the set of options to be used * once the promise resolves. */ - loadOptions?: - | (( - inputValue: string, - callback: (options: OptionsOrGroups) => void - ) => void) - | ((inputValue: string) => Promise>); + loadOptions?: ( + inputValue: string, + callback: (options: OptionsOrGroups) => void + ) => Promise> | 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