Skip to content

Commit 8034c22

Browse files
committed
fix: improved logic for allow tokens into the values
1 parent da962d2 commit 8034c22

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/jacaranda/src/index.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,15 @@
4040
// }
4141
// });
4242

43-
import { ImageStyle, TextStyle, ViewStyle } from 'react-native';
43+
import { ImageStyle, TextStyle, ViewStyle, DimensionValue } from 'react-native';
4444

45-
// Types for variant styles
46-
type StyleObject = ViewStyle | TextStyle | ImageStyle;
45+
type TokenString = `$${string}`;
46+
47+
export type StyleObject = Partial<{
48+
[K in keyof (ViewStyle & TextStyle & ImageStyle)]:
49+
| (ViewStyle & TextStyle & ImageStyle)[K]
50+
| (K extends keyof ViewStyle ? TokenString | DimensionValue : TokenString);
51+
}>;
4752

4853
// Define the VariantOptions type to ensure type safety in variant definitions
4954
type VariantOptions<V> = {
@@ -138,3 +143,7 @@ export function styles<V extends VariantOptions<V>>(config: VariantStyleConfig<V
138143
return styles;
139144
};
140145
}
146+
147+
// Add these types above the existing types
148+
149+
export { createTokens } from './tokens';

0 commit comments

Comments
 (0)