No type definition for TypeScript users
francoismassart opened this issue · comments
Working on a vue.js project made with TypeScript, I was not able to compile because of the lack of a definition file.
Here is how I worked round this but I'd appreciate a real definition file with all its benefits 👍
In my shims-vue.d.ts
file I added:
declare module 'v-clipboard' {
import { PluginObject } from 'vue';
const vClipboard: PluginObject;
export default vClipboard;
}
Can you create a PR with it?
This didn't work for me - says that PluginObject needs a type - if I use PluginObject<{}>
it compiles but it still does not compile with this.$clipboard
...
Thanks it works on my project.
@mika76 did you try it ? It should work
Hey @francoismassart sorry I didn't see the update - I will give it a go and let you know...
in main.ts
import Clipboard from 'v-clipboard';
Vue.use(Clipboard);
When trying to use -> this.$clipboard(value);
Property '$clipboard' does not exist on type 'myComponent'.
dependency in package.json -> "v-clipboard": "^2.2.2",