TypeScript Debounce Function with Cancel and Immediate Execution

0

Create a JavaScript function that implements a robust debounce with TypeScript definitions. Include cancel capability, immediate execution option (leading/trailing edge), and proper `this` context binding. The function should accept [callback_function] with [wait_time]ms delay and return [return_type]. Add TypeScript generics for type-safe arguments and return values, handle edge cases like rapid cancellations, and provide both CommonJS and ES module exports. Include JSDoc comments and usage examples for [use_cases] scenarios.

Created by alekx

Prompt has not been run.