JedWatson / JedWatson/react-select

makeAnimated components prevent Typescript type inference

Open
#5,172 0 comments 0 reactions 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

When creating animated components with makeAnimated() and passing them as components props then the type inference is not working anymore: options are now unknown type:

image

When removing the components prop then options type is inferred correctly:

image

https://codesandbox.io/s/react-select-v5-sandbox-forked-net2gc?file=/example.js

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 with the linked CodeSandbox reproduction in example.js and compare type inference with and without the components prop when using makeAnimated(). Trace the affected TypeScript definitions and verify that the component options are no longer inferred as unknown while preserving the existing inference behavior.

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
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.