Skip to content

Commit 412962f

Browse files
authored
Fix styleVariants type when using the map data function
1 parent 31172c3 commit 412962f

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

.changeset/brown-rice-draw.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@vanilla-extract/css": patch
3+
---
4+
5+
Fix `styleVariants` type when using the map data function

packages/css/src/style.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,12 @@ export function globalKeyframes(name: string, rule: CSSKeyframes) {
137137
export function styleVariants<
138138
StyleMap extends Record<string | number, ComplexStyleRule>,
139139
>(styleMap: StyleMap, debugId?: string): Record<keyof StyleMap, string>;
140-
export function styleVariants<Data extends Record<string | number, unknown>>(
140+
export function styleVariants<
141+
Data extends Record<string | number, unknown>,
142+
Key extends keyof Data,
143+
>(
141144
data: Data,
142-
mapData: <Key extends keyof Data>(
143-
value: Data[Key],
144-
key: Key,
145-
) => ComplexStyleRule,
145+
mapData: (value: Data[Key], key: Key) => ComplexStyleRule,
146146
debugId?: string,
147147
): Record<keyof Data, string>;
148148
export function styleVariants(...args: any[]) {

0 commit comments

Comments
 (0)