Atlaskit Select isMulti not working

Here is my code, which used to work until one of the latest updated.

<Select
           id="select-components"
           options={this.props.componentsOptions}
           value={this.props.components}
           placeholder={placeholder}
           isMulti={true}
           onChange={(value) => this.onChange(value as Option[])}
 />

Now I’m getting the following Typescript error for isMulti={true} : Type 'true' is not assignable to type 'false'.

What’s the right way to have a multi select now?

2 Likes

Try isMulti="true" or just <Select isMulti />

Thanks @nhac.tat.nguyen, the 3 are equivalent.
Same result.

Hi Lorenzo, I can confirm the isMulti prop is the correct way to make a multi-select. I haven’t been able to reproduce the type errors you’ve encountered. Would you be able to re-produce this issue in a code sandbox? Here’s one I built that sets isMulti and doesn’t appear to encounter these type issues.

Hey @acampbell3, thanks for the reply.

Seems to be a problem with react-select types.
Check the comments in react-select - Added isMulti generic to react-select for conditional types by Dahaden · Pull Request #49673 · DefinitelyTyped/DefinitelyTyped · GitHub

Here I could reproduce the issue, GitHub - LorenzoR/react-16-select-error: react-select error example

The temporary fix is to use the old version, @types/react-select@3.0.26

1 Like