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 type for presets should allow config without content property #11725

Closed
wimbarelds opened this issue Jul 31, 2023 · 1 comment · Fixed by #11730
Closed

Typescript type for presets should allow config without content property #11725

wimbarelds opened this issue Jul 31, 2023 · 1 comment · Fixed by #11730
Assignees

Comments

@wimbarelds
Copy link
Contributor

wimbarelds commented Jul 31, 2023

What version of Tailwind CSS are you using?

3.3.2

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

postcss 8.3.1, Next.js 13.4.9, webpack 5.88.2

What version of Node.js are you using?

For example: v18.16.0

What browser are you using?

N/A

What operating system are you using?

vscode devcontainer from mcr.microsoft.com/vscode/devcontainers/typescript-node:0-18-bullseye

Reproduction URL

https://codesandbox.io/s/upbeat-engelbart-srwsmw?file=/src/tailwind.preset.ts

Describe your issue

content is required in preset, but preset configs sometimes/often/generally should not override the content property.

[edit] Updated the code-sandbox slightly to better illustrate the point.

The (js) example on the tailwind website does not have a content property.
https://tailwindcss.com/docs/presets

Currently the relevant typing is:

interface OptionalConfig {
  // ...
  presets: Partial<PresetsConfig>;
  // ...
}

type PresetsConfig = Config[];

Instead, I think it should be:

interface OptionalConfig {
  // ...
  presets: PresetsConfig;
  // ...
}

type PresetsConfig = Partial<Config>[];

(I assume the intent was to make array members partial, instead of making the array itself partial; as I cannot come up with any reason why the array itself should be partial/would benefit from being partial)

@RobinMalfait
Copy link
Contributor

Hey, thank you for this bug report! 🙏

This should be fixed by #11730, and will be available in the next release.

You can try it by using the insiders build (which should be available within the next 10 minutes)

  • 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

Successfully merging a pull request may close this issue.

2 participants