malekim / v-idle

A Vue.js plugin to detect idle/non-active users
https://malekim.github.io/v-idle/
MIT License
70 stars 8 forks source link

Could not find a declaration file for module 'v-idle' #22

Closed someone1 closed 9 months ago

someone1 commented 3 years ago

Firstly, thank you for such a useful and well designed package!

Can this package please be updated to generate and ship with types? I see it's already coded in typescript so it should hopefully be a trivial change to the build + deploy steps?

someone1 commented 3 years ago

if anybody is curious for a shim d.ts file:

declare module 'v-idle' {
    import { PluginObject } from 'vue';

    const Vidle: PluginObject<Record<string, never>>;

    export default Vidle;
}
malekim commented 3 years ago

I've got it on my list, I will prioritize this issue. Thank you.

ghost commented 3 years ago

@malekim thanks for creating this package. What is the status of this issue?

ghost commented 3 years ago
declare module 'v-idle' {
    import { PluginObject } from 'vue';

    const Vidle: PluginObject<Record<string, never>>;

    export default Vidle;
}

I've added it to my shims-vue.d.ts file but it's giving me an error of Module '"vue"' has no exported member 'PluginObject'.ts(2305)

masus04 commented 2 years ago

if anybody is curious for a shim d.ts file:

declare module 'v-idle' {
    import { PluginObject } from 'vue';

    const Vidle: PluginObject<Record<string, never>>;

    export default Vidle;
}

I'm rather new to typescript, how can I use this to make the plugin work? Where do i put this snippet?

masus04 commented 2 years ago

I've added a v-idle.d.ts file to my project and referenced it in the tsconfig.json, now it does not throw an error regarding types any more.

I do however get the following error now. The same error occurs when I try to use the require syntax without any type information:

Uncaught TypeError: Vue.extend is not a function
    at eval (vidle.min.js?4639:1:1)
    at Object../node_modules/v-idle/build/vidle.min.js (chunk-vendors.js:9848:1)
    at __webpack_require__ (app.js:849:30)
    at fn (app.js:151:20)
    at eval (main.ts:13:64)
    at Module../src/main.ts (app.js:2292:1)
    at __webpack_require__ (app.js:849:30)
    at fn (app.js:151:20)
    at Object.1 (app.js:2723:18)
    at __webpack_require__ (app.js:849:30)