linaria icon indicating copy to clipboard operation
linaria copied to clipboard

Typescript Enums are undefined

Open notwillk opened this issue 4 years ago • 0 comments

Environment

  • Linaria version: 3.0.0-beta.15
  • Bundler (+ version): 5.68.0
  • Node.js version: v16.13.2
  • OS: mac OS 10.15.7

Description

Using typescript enums does not work in linaria CSS.

Reproducible Demo

enum Something = {
  one: 'one',
  two: 'two`
}

const HEIGHTS: Record<Something, string> = {
  [Something.one]: '1px',
  [Something.two]: '100px',
}

const Fancy = styled.div`
  height: ${HEIGHTS[Something.one]};
`

Compiling this results in an error, where Something is undefined when trying to evaluate HEIGHTS[Something.one].

notwillk avatar Feb 14 '22 22:02 notwillk