Skip to content

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

Closed
@baffalop

Description

@baffalop

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)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions