vue-cookie-accept-decline
vue-cookie-accept-decline copied to clipboard
TypeScript Support
Following the example usage gives the following error: Could not find a declaration file for module 'vue-cookie-accept-decline'. './node_modules/vue-cookie-accept-decline/dist/vue-cookie-accept-decline.umd.js' implicitly has an 'any' type.
Hey there - sorry this component does not support TypeScript out of the box.
What you could do is add a declaration file for it to get rid of the error. When you use it, it won't be type-safe, but at lease it won't error. Link on how to do that here. (It also mentions how to add some typing's for yourself.)
If I get some time, I may add TypeScript support to this project - but it's just tougher with the options API that this component was built with. I'm just super booked now, sorry.
I'm using it in a VITE project having TS with no problem.
any updates on this?
@shidcordero Sorry, there are currently no plans to upgrade this component to use TypeScript directly.
I think the best way to use this component in a TypeScript project is to add a simple declarations file as mentioned above. You can then additionally add typing for the methods and variables you intend to use.
At that point, I could place that directly in this project for others to use. It wouldn't be a "real" TypeScript project, but it would be something.
Anyways, sorry for the trouble. I'm a huge TypeScript fan, it's just these older "options" API Vue libraries are tough to use with TypeScript, I've experienced.