Skip to content

Commit

Permalink
Fix styleVariants type when using the map data function
Browse files Browse the repository at this point in the history
  • Loading branch information
m7yue authored Sep 5, 2022
1 parent 31172c3 commit 412962f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/brown-rice-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@vanilla-extract/css": patch
---

Fix `styleVariants` type when using the map data function
10 changes: 5 additions & 5 deletions packages/css/src/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,12 @@ export function globalKeyframes(name: string, rule: CSSKeyframes) {
export function styleVariants<
StyleMap extends Record<string | number, ComplexStyleRule>,
>(styleMap: StyleMap, debugId?: string): Record<keyof StyleMap, string>;
export function styleVariants<Data extends Record<string | number, unknown>>(
export function styleVariants<
Data extends Record<string | number, unknown>,
Key extends keyof Data,
>(
data: Data,
mapData: <Key extends keyof Data>(
value: Data[Key],
key: Key,
) => ComplexStyleRule,
mapData: (value: Data[Key], key: Key) => ComplexStyleRule,
debugId?: string,
): Record<keyof Data, string>;
export function styleVariants(...args: any[]) {
Expand Down

0 comments on commit 412962f

Please sign in to comment.