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

I think the `$type` alias is to allow for parsers just to know to check an object and its properties. Otherwise how would it know to check for colors? It’d have to assume a token structure (like all colors are under top level `color` property).

It also helps explicitly define the type of the token, since you might want to mix tokens to achieve another (like combining opacity number and RGB color to make a RGBA new color). Or for example, if you multiply `fontSize` and a `spacing` token, what is the type of the result? Might get weird for parsers. 

I do think there you have a great idea of not including it every time though. It seems verbose and makes it difficult to manually parse JSON without a tool to strip the noise. Not sure how to practically achieve that without an explicit structure or some other system to accommodate for the inference of types. 

Also this issue emphasizes the need for a section of the docs on parsing, and expectations the spec has - to create some consistency between tooling.  

-- 
GitHub Notification of comment by whoisryosuke
Please view or discuss this issue at https://github.com/design-tokens/community-group/issues/236#issuecomment-2052200847 using your GitHub account


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

Received on Friday, 12 April 2024 17:42:35 UTC