From de8b26663405e12e9c0ba1850d47d165981adbbf Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 27 Feb 2022 23:44:23 -0500 Subject: [PATCH 1/2] Fix type inference for Async's loadOptions prop --- packages/react-select/src/useAsync.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) 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 From 7184d538f587c1dd5a4ca5ad6cc0745fbb8d3809 Mon Sep 17 00:00:00 2001 From: Nathan Bierema Date: Sun, 27 Feb 2022 23:45:08 -0500 Subject: [PATCH 2/2] Create serious-cheetahs-give.md --- .changeset/serious-cheetahs-give.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/serious-cheetahs-give.md 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