JedWatson / JedWatson/react-select

isMulti in AsyncSelect - typescript

Open
#5,522 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

issue/bug-unconfirmed
Dominant language
TypeScript
Stars
28k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

Hi everyone,
I have a problem, when I want to use AsyncSelect with isMulti={true} I see TS error

<AsyncSelect
      isMulti={true}
      cacheOptions={false}
      loadOptions={loadOptions}
      closeMenuOnSelect={true}
      formatOptionLabel={FormatOptionLabel}
      components={{ Control, MenuList }}
      styles={selectStyles}
      placeholder={placeholder}
      noOptionsMessage={noOptionsMessage}
      openMenuOnClick={false}
      onChange={selectedOptions => setValue(selectedOptions)}
      value={value}
      isDisabled={isDisabled}
      onKeyDown={e => e.key === 'Enter' && changeQuery()}
      inputValue={inputValue}
      onInputChange={(newValue, { action }) => action !== 'menu-close' && setInputValue(newValue)}
    />
(property) isMulti?: false | undefined
Support multiple selected options

Type 'true' is not assignable to type 'false'.ts(2322)

Someone has any idea for it?

I'm using:
react-select: 5.7.0
typescript: 4.9.4
react: 18.2.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the TypeScript definitions for the AsyncSelect entry point in react-select 5.7.0 and reproduce the reported error with isMulti={true}. Determine why the prop is inferred as false, then verify that the shown AsyncSelect usage type-checks without the error.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.