Replies: 1 comment 1 reply
-
Restricting vars to strings was a deliberate choice to avoid confusion around handling of numbers and automatic For example, let's say you have the following style: export const className = style({
padding: 12
}); In this case, the However, if we supported numbers as variables and you refactored the code like this, it would break: const vars = createGlobalTheme(':root', {
padding: 12
});
export const className = style({
padding: vars.padding
}); At runtime, the style would literally resolve to To try and avoid this trap, we made numbers a type error to make you realise you're defining a CSS value directly and that you might need to add units: const vars = createGlobalTheme(':root', {
padding: '12px'
});
export const className = style({
padding: vars.padding
}); That said, we may still change this if there's enough demand, but just wanted to explain the current behaviour. |
Beta Was this translation helpful? Give feedback.
-
I'm building a custom tokens system, but I get a TS error when I try to pass in a tokens object as follows.
This is because the definition number is missing in the type of Tokens,
can we add it?
Beta Was this translation helpful? Give feedback.
All reactions