Skip to content

Commit

Permalink
Move typecasting outside
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Sep 14, 2023
1 parent 4d9ee2a commit dc50322
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/component/src/Styles/CSSTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ type CSSTokensType<T extends Readonly<Record<string, string>>> = {
};

// To add/remove/update a token, go to `CustomPropertyName.ts`.
const CSSTokens = new Proxy<CSSTokensType<CustomPropertyNamesType>>({} as CSSTokensType<CustomPropertyNamesType>, {
get(_, key: keyof CustomPropertyNamesType) {
// We already checked in the `CustomPropertyName`.
// eslint-disable-next-line security/detect-object-injection
return `var(${CustomPropertyNames[key]})`;
const CSSTokens = new Proxy(
{},
{
get(_, key: keyof CustomPropertyNamesType) {
// We already checked in the `CustomPropertyName`.
// eslint-disable-next-line security/detect-object-injection
return `var(${CustomPropertyNames[key]})`;
}
}
});
) as CSSTokensType<CustomPropertyNamesType>;

export default CSSTokens;

0 comments on commit dc50322

Please sign in to comment.