-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Type definitions for the configuration file #3263
Conversation
Wow thanks for this! I've asked someone on our team who is better with TypeScript to review this and compare it with what we use for types on Tailwind Play, we can probably unify this work somehow 👍🏻 Will hear back from us again in a week or two, sorry for the delay! |
Thanks for the reply! I lack the necessary time at the moment but there are a couple other things I thought could be addressed with this PR:
I'm no expert in typescript (hence why I didn't use I guess one possible way would be with generics and the definitions would be added to /**
@type {import('tailwindcss').Config<
PluginDefinitions & PluginDefinitions2
>}
*/ Anyways, this is just something I came up with and did not test at all, maybe the other week if I find some time. |
We are using this package for types at the moment /**
* @type {import('tailwindcss/tailwind-config').TailwindConfig}
*/
module.exports = {
// ...
} |
@adamwathan @arpadgabor are there any missing pieces the community can help to get this integrated? |
@alvis at the moment the definitions must be updated to match new utilities from the last few updates. I'd be willing to update the PR if @adamwathan or someone else in the team is interested in merging this. |
Hey! We ended up adding types ourselves in March in this PR: #7891 I completely forgot this one was open otherwise we would have built it on top of yours — so sorry about that 🤦🏻♂️ Thank you so much for the PR regardless, hope you continue to contribute in the future. |
Haha, no worries 🙈, haven't noticed so it's good you mentioned. Thanks! |
This PR adds a new
index.d.ts
file that contains type definitions for the configuration object intailwind.config.js
.With this change every property can be quickly documented so developers can prototype faster instead of looking through the documentation for property names.
Usage:
Features:
Types and interfaces for most (if not all) config properties + variations (e.g. font size with line height)
Links to documentation for most properties
Variants with auto-complete in the string array
Update to
stubs
to include the JSDoc annotation in new projectsScreenshots
Disclaimer: This is my first ever PR, changes should be non-breaking, there may be typos.