Skip to content

Commit

Permalink
fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
siriwatknp committed Jan 8, 2024
1 parent 2ab577f commit cc913db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/serialize/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ export type CSSPropertiesWithMultiValues<Props = unknown> = {
[K in keyof CSSProperties]:
| CSSProperties[K]
| ReadonlyArray<Extract<CSSProperties[K], string>>
| ((props: Props) => number | string)
| ((
props: Props
) => CSSProperties[K] | ReadonlyArray<Extract<CSSProperties[K], string>>)
}

export type CSSPseudos<Props = unknown> = {
Expand Down Expand Up @@ -39,7 +41,7 @@ export type CSSInterpolation<Props = unknown> =
export interface CSSOthersObject<Props = unknown> {
[propertiesName: string]:
| CSSInterpolation<Props>
| ((props: Props) => number | string)
| ((props: Props) => CSSInterpolation<Props>)
}

export interface CSSObject<Props = unknown>
Expand Down
2 changes: 2 additions & 0 deletions packages/serialize/types/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ serializeStyles(
// $ExpectType SerializedStyles
serializeStyles<{ vars: { background: string; foreground: string } }>([
{
display: () => ['-webkit-flex', 'flex'],
backgroundColor: ({ vars }) => vars.background,
color: ({ vars }) => vars.foreground,
lineHeight: ({ vars }) => 1.2,
'--css-var': ({ vars }) => vars.foreground,
'&:hover': {
backgroundColor: ({ vars }) => vars.foreground,
color: ({ vars }) => vars.background
Expand Down

0 comments on commit cc913db

Please sign in to comment.