Skip to content

Commit 21e2197

Browse files
Fix type errors with nested null values in theme contracts (#274)
1 parent d2f48b5 commit 21e2197

File tree

3 files changed

+16
-1
lines changed

3 files changed

+16
-1
lines changed

.changeset/weak-planets-rush.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 type errors with nested null values in theme contracts

packages/css/src/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export interface Adapter {
111111
}
112112

113113
export type NullableTokens = {
114-
[key: string]: string | Tokens | null;
114+
[key: string]: string | NullableTokens | null;
115115
};
116116

117117
export type Tokens = {

tests/types/type-tests.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,25 @@ import {
66

77
const vars = createThemeContract({
88
shouldSupportNull: null,
9+
shouldSupportNestedNull: {
10+
nested: null,
11+
},
912
shouldSupportString: '',
13+
shouldSupportNestedString: {
14+
nested: '',
15+
},
1016
});
1117

1218
createGlobalTheme(':root', vars, {
1319
shouldSupportNull: 'some-value',
20+
shouldSupportNestedNull: { nested: 'some-value' },
1421
shouldSupportString: 'some-value',
22+
shouldSupportNestedString: { nested: 'some-value' },
1523
});
1624

1725
createTheme(vars, {
1826
shouldSupportNull: 'some-value',
27+
shouldSupportNestedNull: { nested: 'some-value' },
1928
shouldSupportString: 'some-value',
29+
shouldSupportNestedString: { nested: 'some-value' },
2030
});

0 commit comments

Comments
 (0)