From 82884cbf67020daec6f4528ebea182885d534a5c Mon Sep 17 00:00:00 2001 From: Emil Ivanichkov Date: Fri, 9 Feb 2024 20:09:10 +0200 Subject: [PATCH] feat(tokens): Make colors from `tokens.ts` reusable my setting `ColorTokens` type --- tokens.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tokens.ts b/tokens.ts index e60923b0..d3cea639 100644 --- a/tokens.ts +++ b/tokens.ts @@ -1,6 +1,11 @@ import { customisation } from '@status-im/colors' import { createTokens } from '@tamagui/core' -import { size, space, zIndex } from '@tamagui/theme-base' +import { size, space, zIndex } from '@tamagui/themes' +import { ColorTokens } from 'tamagui'; + +type ColorObject = { + [key: string]: ColorTokens; +} export const tokens = createTokens({ color: { @@ -200,6 +205,9 @@ export const tokens = createTokens({ }, }) +// eslint-disable-next-line @typescript-eslint/no-explicit-any +export const colorsTyped: ColorObject = tokens.color as { [key: string]: any }; + type GetTokenString = A extends string | number ? `$${A}` : `$${string}` type RadiusTokens = GetTokenString | number