I'm not sure if this is something that can be addressed, or if there's another way to extract the enumerable values for a given property?
I actually thing there's more going on here. textAlign in the first code snippet works great. But if provided display or color, it also creates a type that's just string
The
PropertyValue
TypeScript utility works great when you know the CSS property ahead of time:I have a case where I don't know the CSS property up front. It's an input in a function. So I have something like this:
The values then get reduced to
string | undefined
orstring | 0 | undefined
:I'm not sure if this is something that can be addressed, or if there's another way to extract the enumerable values for a given property?
I actually thing there's more going on here.
textAlign
in the first code snippet works great. But if provideddisplay
orcolor
, it also creates a type that's juststring
Recreation of the bug here: https://codesandbox.io/s/csstype-autocomplete-bugs-tciq55?file=/src/propertyvalue-bug.ts