In VueJS (Javascript) I can do this:
import debounce from "lodash/debounce";
...
watch: {
variable: debounce(function() {
console.log('wow');
}, 500)
}
In VueJS (Typescript) I try:
npm i lodash-es
npm i @types/lodash-es -D
In component:
import { Component, Vue, Watch } from "vue-property-decorator";
import debounce from "lodash-es/debounce";
...
@Watch("variable")
debounce(function() {
console.log('wow');
}, 500)
But I get errors:
- 'debounce', which lacks return-type annotation, implicitly has an 'any' return type.
- Member '500' implicitly has an 'any' type.
P.S. This works fine:
func = debounce(() => {
console.log('wow');
}, 500)