-
-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
defineConfig does not seem to support theme functions #257
Comments
Thank you for reporting this issue. Typing the theme property is really challenging. After some investigation I got it working like this: theme: {
simple: {
a: '1',
},
// must use type for section resolvers
// referencing other theme section
custom: ({
theme,
}: ThemeSectionResolverContext<TailwindTheme>): TailwindTheme['colors'] => ({
gray: theme('colors.gray'),
}),
// overwrite existing section
fill: ({ theme }: ThemeSectionResolverContext<TailwindTheme>): TailwindTheme['colors'] => ({
gray: theme('colors.gray'),
}),
extend: {
// types are infered in extend
// extending existing section
divideColor: ({ theme }) => ({
gray: theme('colors.gray'),
}),
},
}, I will publish a version with this fix soon. If you have any idea how we can omit the types outside |
No worries - good ol'
Oh I believe it! Semi related to #201 (comment), if I can find the time I'm hoping to dig into how Stitches has put together their typings - they're achieved some voodoo magic over there, surprised re how well they managed to integrate custom themes with typings/autocomplete out of the box. |
It is little different here in twind. We have to combine themes from the presets with the user provided one. If you find a good solution PRs are very welcome. |
On Theme prop not available on the theme function It's typed as https://github.com/tw-in-js/twind/blob/next/packages/twind/src/types.ts#L372-L377, so it seems to make sense that This one has me scratching my head If I copy this same config into the |
From the
next
branch docs - is the below expected to work already? When added to adefineConfig()
(from@twind/tailwind
), ends up throwing a bunch of errors.The text was updated successfully, but these errors were encountered: