emmanuelsw / notiwind

A headless Vue 3 notification library to use with Tailwind CSS.
https://notiwind-demo.netlify.app
MIT License
277 stars 28 forks source link

Added typescript definitions #23

Closed tristanlins closed 1 year ago

tristanlins commented 2 years ago

Compared to #20, these definitions does not declare fixed fields. Notiwind itself only expect a field group and this is optional. Can be found here: https://github.com/emmanuelsw/notiwind/blob/main/src/notify.js#L11

All other fields are optional and UI implementation specific. That's the reason why Notification is a map type, in this definition.

At least I added the types entry in the package.json, otherwise typescript or build tools may not resolve the .d.ts automatically.

emmanuelsw commented 2 years ago

Thanks for the PR!

I have a script that generates the ESM and CommonJS modules and it deletes the dist folder in the process, maybe we can do something like this so it doesn't remove the types file:

rm dist/index* && rollup -c

Maybe not the best solution but it can work well for now, the rest is good!

tristanlins commented 2 years ago

Or using the rollup copy plugin, to copy the .d.ts file from src/ into dist/?

emmanuelsw commented 2 years ago

Definitely better.

emmanuelsw commented 1 year ago

TS support added in #29.