We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a61f352 commit 46043fbCopy full SHA for 46043fb
src/09-external-libraries/75-react-select.solution.tsx
@@ -1,11 +1,8 @@
1
import ReactSelect, { GroupBase, Props } from "react-select";
2
import { Equal, Expect } from "../helpers/type-utils";
3
4
-/**
5
- * You need to mimic the exact type of the Props type exported by react-select.
6
- */
7
export const Select = <
8
- Option,
+ Option = unknown,
9
IsMulti extends boolean = false,
10
Group extends GroupBase<Option> = GroupBase<Option>,
11
>(
@@ -34,6 +31,7 @@ const guitarists: Option[] = [
34
31
<Select
35
32
options={guitarists}
36
33
onChange={(option) => {
+ // It should infer the type of option!
37
// If isMulti is false, it should NOT be an array
38
type test = Expect<Equal<typeof option, Option | null>>;
39
}}
0 commit comments