You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am creating a style guide that includes a Prettier config. The Tailwind plugin gets enabled with a boolean or an object of Tailwind plugin options (see screenshot below). Because of that, I don't want the Tailwind config interface merged with the Prettier config. But that is what's happening because of this line in src/index.ts:
I get why this is here, likely to add type safety for Prettier configs in .js files. However, declare is not the way to handle this, IMO. This merged the interfaces globally for everyone using this package, and there's no easy way to override it.
Instead, the type safety can be handled safely with JSDoc in your prettier.config.js like this:
To see this in action, clone my example repo above, or open the sandbox. You'll see the Tailwind plugin options in the autocomplete list inside of prettierConfig({}), even though I didn't include them in my interface.
If you go into node_modules/prettier-plugin-tailwindcss/dist/index.d.ts and delete the declare statement, it will behave as expected.
I'd be more than happy to contribute, or assist with documentation if I can. However, it seems like this would be a breaking change.
The text was updated successfully, but these errors were encountered:
What version of
prettier-plugin-tailwindcss
are you using?v0.6.9
What version of Tailwind CSS are you using?
N/A
What version of Node.js are you using?
v22.12.0
What package manager are you using?
pnpm, npm
What operating system are you using?
macOS
Reproduction URL
Sandbox
GitHub
Describe your issue
I am creating a style guide that includes a Prettier config. The Tailwind plugin gets enabled with a boolean or an object of Tailwind plugin options (see screenshot below). Because of that, I don't want the Tailwind config interface merged with the Prettier config. But that is what's happening because of this line in
src/index.ts
:I get why this is here, likely to add type safety for Prettier configs in
.js
files. However,declare
is not the way to handle this, IMO. This merged the interfaces globally for everyone using this package, and there's no easy way to override it.Instead, the type safety can be handled safely with JSDoc in your
prettier.config.js
like this:/** @type {import('prettier').Config & import('prettier-plugin-tailwindcss').PluginOptions} */
To see this in action, clone my example repo above, or open the sandbox. You'll see the Tailwind plugin options in the autocomplete list inside of
prettierConfig({})
, even though I didn't include them in my interface.If you go into
node_modules/prettier-plugin-tailwindcss/dist/index.d.ts
and delete thedeclare
statement, it will behave as expected.I'd be more than happy to contribute, or assist with documentation if I can. However, it seems like this would be a breaking change.
The text was updated successfully, but these errors were encountered: