notiwind icon indicating copy to clipboard operation
notiwind copied to clipboard

Added typescript definitions

Open tristanlins opened this issue 2 years ago • 3 comments

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.

tristanlins avatar May 12 '22 06:05 tristanlins

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!

emmanuelsw avatar May 19 '22 16:05 emmanuelsw

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

tristanlins avatar May 27 '22 06:05 tristanlins

Definitely better.

emmanuelsw avatar May 30 '22 18:05 emmanuelsw