You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One workaround that could possible be used here is the repetition of type GroupCore in the inner properties and as an isolated union element of type Group.
Ah you’re right this may be an impossible intersection. I actually think we could just have GroupCore | { [key: string]: GroupOrToken | GroupCore } to simplify it, since unions in TypeScript aren’t exclusive (often times they end up working the same as intersections for this reason). But if that doesn’t work, your fix is good!
This typing is more for internal usage, but complexity like this are why typing the DTCG spec with JSONSchema is tricky!
I've been trying to find a good way to nest groups using
@terrazzo/tokens-tools
, but typescript (v5.6.3) seems to not be happy with it.Reproduction @ CodeSandbox
Here are some references I've came across:
One workaround that could possible be used here is the repetition of type
GroupCore
in the inner properties and as an isolated union element of typeGroup
.Before:
Workaround:
Or is there something I'm missing here?
The text was updated successfully, but these errors were encountered: