sinclairnick / brail

💌 Transactional email that feels different
https://brail.dev
Apache License 2.0
258 stars 6 forks source link

Desired behaviour when changing theme tokens? #18

Open sinclairnick opened 1 year ago

sinclairnick commented 1 year ago

Currently, when changing theme tokens, some properties like fontFamily or color which accept arbitrary strings, don't error or otherwise indicate a problem. Ideally we would be notified by TS when we are erroneously using a non-existent token.

On one hand we could narrow string-based options, but in some cases this leads to type-explosions, like border="1px solid green", where the combinatorial for template-literal explodes. A more parsimonious approach could be just to wrap token-able parts with a sort-of ValidateToken<T> type which verifies the type is valid, if it begins with a $.

Not 100% certain on best approach yet.