JedWatson / react-select

The Select Component for React.js
https://react-select.com/
MIT License
27.58k stars 4.12k forks source link

Type error on using a css variable for fontWeight on styles #5073

Open alexpuertasr opened 2 years ago

alexpuertasr commented 2 years ago

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)',
    }),
  }}
/>
Rall3n commented 2 years ago

Hello @alexpuertasr,

Would you be so kind and provide the versions of csstype, @emotion/react and @emotion/serialize in your package-lock.json file (running npm ls PACKAGE should be sufficient)?