JedWatson / JedWatson/react-select
Type error on using a css variable for fontWeight on styles
Open
Nobody has claimed this yet.
awaiting-author-response
issue/bug-unconfirmed
- Dominant language
- TypeScript
- Stars
- 28k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
react-select: 5.2.2
I want to assign as a value a css variable for fontWeight in styles. However the following typescript error appears:
Type '"var(--fontWeights-medium)"' is not assignable to type 'FontWeight | (FontWeight | undefined)[] | ("bold" | Globals | "normal" | "bolder" | "lighter")[] | undefined'.
Example of use:
<Select
styles={{
multiValueLabel: (base) => ({
...base,
fontWeight: 'var(--fontWeights-medium)',
}),
}}
/>
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named in the report. Start by locating the TypeScript definitions behind the Select styles prop and inspect how fontWeight is typed. Done means the shown CSS variable value is accepted without losing the existing font-weight type checking.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- css, react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100