Skip to content

Commit

Permalink
refactor: remove unneccessary CSSProps type cast
Browse files Browse the repository at this point in the history
  • Loading branch information
iamogbz committed Oct 21, 2022
1 parent f156c2c commit 80440c1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.17.3
14.20.1
8 changes: 4 additions & 4 deletions src/components/Reflection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export function mergeStyleProps(
cssProps: React.CSSProperties = {},
inlineCSS = "",
styleDecl?: CSSStyleDeclaration,
) {
): React.CSSProperties {
return {
...(styleDecl &&
asCSSProperties(
Expand All @@ -96,17 +96,17 @@ export function mergeStyleProps(
([, value]) => value?.trim(),
),
...cssProps,
} as React.CSSProperties;
};
}

function asCSSProperties<T>(
items: T[],
getProp: (_: T) => string,
getValue: (_: T) => string | undefined,
) {
): React.CSSProperties {
return Object.fromEntries(
items
.map((item) => [spinalToCamelCase(getProp(item)), getValue(item)])
.filter(([, value]) => Boolean(value)),
) as React.CSSProperties;
);
}

0 comments on commit 80440c1

Please sign in to comment.