[community-group] Alias $type inheritance? (#236)

drwpow has just created a new issue for https://github.com/design-tokens/community-group:

== Alias $type inheritance? ==
Was digging into alias behavior a bit, and I had a few question about alias `$type`s. What are peoples’ thoughts on whether any of the following are **valid** or **invalid**? Also I may have missed a previous conversation or part of the spec that applies to this.

#### Omitting $type

Is this valid?

```json
{
  "color": {
    "a": { "$type": "color", "$value": "#336699" },
    "b": { "$value": "{color.a}" }
}
```


#### $type mismatch

Will `color.b` be a color, and be validated as such (sort of an extension of the previous one)?

```json
{
  "color": {
    "a": { "$type": "color", "$value": "#336699" },
    "b": { "$type": "dimension", "$value": "{color.a}" }
}
```

And an even bigger question: **is declaring ANY `$type` on an alias invalid?**

#### $type inheritance

Will the inherited `$type` also apply to the alias? (and override any possible `$type` the alias may have)?

```json
{
  "base": {
    "$type": "color",
    "a": { "$value": "#336699 }
  },
  "semantic": { "$value": "{base.a}" }
}
```

---

In all of these, I’d like to **reduce error** as much as possible, and I can’t think of a good reason for even declaring `$type` on aliases because there’s at best there’s duplication; at worst there’s the possibility of a conflict. And wondering **when it’s helpful to err, when it’s helpful to warn, and when it’s helpful to do nothing (silently work)**

Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/236 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Tuesday, 9 April 2024 13:18:38 UTC