Proposal for config non-breaking Typescript definitions [WIP] #2489
arpadgabor
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Type definitions for the config file would be an awesome addition to TailwindCSS as it would help tremendously while making different changes to the config. I've put together a "small"
.ts
file to see how easy it is.How it would work
A new file would be created in
src/types/index.ts
. Then, to make things easy for users, a new function in/useConfig.js
is created that takes as parameter theconfig
and then returns it back for backwards compatibility.The user would import this function and export the value it returns, so there is no need for any other internal Tailwind changes.
Preview in editor
Ok so I'm no expert, but I guess this would be an easy way to integrate types into the config file without changing other internal code or processes.
A huge advantage that I see here is that by adding JSDocs into the types, links to the documentation would improve the experience of both new users and old, and it would also improve the discoverability of different features and/or experimental features.
Open for feedback, help and critique.
PS: I saw that other discussion about type definitions but it's pretty stale, so I thought it would be a good idea to come up with a new one and actual content to discuss on.
Beta Was this translation helpful? Give feedback.
All reactions