Skip to content

Commit

Permalink
⬆️ Upgrade to TS 5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
sergei-maertens committed Feb 12, 2024
1 parent ee983d6 commit d06b75c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 17 deletions.
16 changes: 8 additions & 8 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 @@ -79,7 +79,7 @@
"sass": "^1.57.1",
"storybook": "^7.6.14",
"style-dictionary": "^3.7.2",
"typescript": "^4.9.4",
"typescript": "^5.3.3",
"webpack": "^5.75.0"
},
"peerDependencies": {
Expand Down
11 changes: 5 additions & 6 deletions src/TokenEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,21 @@ const reducer = (state: TokenEditorState, action: ReducerAction): TokenEditorSta
};

const toStyleDictValues = (values: ValueMap): StyleDictValueMap => {
let styleDictValues = {} satisfies StyleDictValueMap;
let styleDictValues: StyleDictValueMap = {};

values.forEach((value, tokenPathBits) => {
if (value === '') return;

let parent = styleDictValues;

// deep assign for each bit in tokenPathBits
let parent = styleDictValues;
for (const bit of tokenPathBits) {
if (!parent[bit]) {
parent[bit] = {};
}
parent = parent[bit];
// a lie for the last iteration, but we correct it later
parent = parent[bit] as StyleDictValueMap;
}

(parent as StyleDictValue).value = value;
(parent as unknown as StyleDictValue).value = value;
});

return styleDictValues;
Expand Down
2 changes: 1 addition & 1 deletion src/TokenFilter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export const applyFilters = (
): DesignTokenContainer => {
if (!filterEnabled) return container;

const filteredContainer = {};
const filteredContainer: TopLevelContainer = {};
Object.entries(container).forEach(([key, nested]) => {
if (key === '$extensions') {
filteredContainer[key] = nested;
Expand Down
1 change: 0 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"allowSyntheticDefaultImports": true
},
"include": ["src"],
Expand Down

0 comments on commit d06b75c

Please sign in to comment.