Skip to content

Commit

Permalink
feat: add originalType to studio extensions, fix type issues wrt opti…
Browse files Browse the repository at this point in the history
…onals
  • Loading branch information
jorenbroekema committed Jul 4, 2024
1 parent a611e37 commit 4ed326b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-mice-share.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@tokens-studio/types': minor
---

BREAKING: $extensions['studio.tokens'] is now optional, modify inner prop is optional, $extensions is extendable with other namespaces, add originalType meta prop to studio.tokens namespace.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"rimraf": "^5.0.0",
"rollup": "^3.20.2",
"typedoc": "^0.24.1",
"typescript": "^5.0.4"
"typescript": "^5.5.3"
},
"keywords": [
"design tokens",
Expand Down
11 changes: 10 additions & 1 deletion src/types/tokens/SingleGenericToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,16 @@ type _SingleGenericToken<T, V, Named, P> = {
oldValue?: V;
internal__Parent?: string;
inheritTypeLevel?: number;
$extensions?: { 'studio.tokens': { modify: ColorModifier } };
$extensions?: {
'studio.tokens'?: {
modify?: ColorModifier,
// this may be set by sd-transforms when aligning the Tokens Studio types to the DTCG types
// so that certain transforms can still match tokens e.g. letterSpacing -> dimension, but the letterspacing
// transform only wants to match for letterSpacing tokens, not all dimension tokens.
originalType?: T;
},
[key: string]: object | undefined
};
} & (Named extends true
? {
name: string;
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"module": "NodeNext",
"declaration": true,
"moduleResolution": "nodenext",
"moduleResolution": "NodeNext",
"lib": ["ESNext", "dom"],
"allowSyntheticDefaultImports": true,
"strict": true,
Expand Down

0 comments on commit 4ed326b

Please sign in to comment.