Perhaps there are already solutions out there, and I appreciate it if you can share a link to an existing thread. Nevertheless...
In React, when I use the style
prop, I receive good autocompletion and validation features like this example: https://i.sstatic.net/TiDgp.png
What am I looking for?
I aim to apply the same functionality to my variables. For instance, in the following code snippet:
const position: ProperType = 'staticcc';
I wish to replace ProperType
with a suitable type that enables:
- VSCode to highlight errors on
position
(since 'staticcc' is not a valid value for the CSS position property) - Auto-completion suggestions similar to the screenshot mentioned earlier.
I believe there must be a specific library or something similar with predefined types. I came across csstype, which works well for objects assigned to the style
prop. However, I require a unique type for a particular CSS property to assign to a specific variable, and I'm unsure how to achieve this.