function getAPI() {
return {
display_hello() {
console.log('hello')
},
display_world: lodash_throttle(() => {
// how to use display_hello in this situation?
this.display_hello(); // error: 'this' implicitly has type 'any' because it does not have a type annotation.
}, 1000)
};
}
function lodash_throttle(f: () => void, ms: number) {
// just an example, doesn't throttle anything
return f;
}
The Playground lets you write TypeScript or JavaScript online in a safe and sharable way.