- From: James Nash via GitHub <sysbot+gh@w3.org>
- Date: Wed, 13 Jul 2022 16:41:44 +0000
- To: public-design-tokens-log@w3.org
@KyleWpppd Perhaps the spec's wording doesn't make this clear, but what you've described _is_ how things should work. As per [my earlier comment](https://github.com/design-tokens/community-group/issues/139#issuecomment-1166640576), a `$type` property on a token has the highest precedence when resolving that token's type. Therefore, if that token happens to reference another token which has a different type, then that is an error since the value will be incompatible. By having `$type` optional, we afford authors to express their intent in a more nuanced way. For example: ```jsonc { "token-a": { "$type": "dimension", "$value": "1rem" }, // token-b's resolved type is "dimension" // If the author's intent is: token-b is just another name for token-a, regardless of what // token-a's type is, then they can express that by not setting $type and thus having the // the resolved type be determined by the other token they are referencing. "token-b": { "$value": "{token-a}" }, // This token's resolved type is color. However, it is invalid // as its value references a non-color token. Tools are therefore // required to reject this token and should show an appropriate // warning or error message to the user. // If the author's intent is: token-c must be a color, so I want tools to warn // me if I accidentally reference a non-color token, then this is the way to // achieve that. "token-c": { "$type": "color", "$value": "{token-a}" } } ``` -- GitHub Notification of comment by c1rrus Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/139#issuecomment-1183446510 using your GitHub account -- Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config
Received on Wednesday, 13 July 2022 16:41:46 UTC