Skip to content
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

Typescript: resolveConfig return type does not represent theme merging #12264

Closed
baffalop opened this issue Oct 22, 2023 · 1 comment
Closed
Assignees

Comments

@baffalop
Copy link
Contributor

What version of Tailwind CSS are you using?

v3.3.3

What version of Typescript are you using?

v5.2.2

What build tool (or framework if it abstracts the build tool) are you using?

Vite 4.5.0

What version of Node.js are you using?

v18.13.0

What browser are you using?

Chrome

What operating system are you using?

macOS

Reproduction URL

https://github.com/baffalop/tailwind-resolveconfig-repro/blob/main/src/main.ts

Describe your issue

The return type for resolveConfig does not accurately represent what will be returned for the theme config. It's typed as simply returning the config passed in (via UnwrapResolvables), but the resolved theme output potentially differs significantly from this.

I would expect all of the default theme keys to be present, unless overridden; and they should be merged with the contents of extend.

It's particularly problematic that config.theme.extend is preserved in the return type, but absent in the actual return value, causing typescript to allow a runtime error if this is accidentally accessed.

This issue was originally pointed out to me here: #6422 (comment)

@RobinMalfait
Copy link
Member

Hey!

This should be fixed by #12272, and will be available in the next release. Once again, thanks for your contribution!

You can already try it by using the insiders build npm install tailwindcss@insiders.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants