This is not related to the changes in this PR, but I have a question regarding the debounce implementation, especially about the return type of func.
Currently, the func argument is typed to return unknown. Is this considered type-safe in TypeScript?
For example, if I pass an async function that returns a Promise<boolean> to debounce, the resulting debounced function’s return type becomes unknown, which requires type assertions or runtime checks when using the return value.
Would it be possible or preferable to type the debounced function so that it preserves the original return type of func, instead of returning unknown?
Originally posted by @yujeong-jeon in #275 (comment)
This is not related to the changes in this PR, but I have a question regarding the debounce implementation, especially about the return type of
func.Currently, the
funcargument is typed to returnunknown. Is this considered type-safe in TypeScript?For example, if I pass an async function that returns a
Promise<boolean>to debounce, the resulting debounced function’s return type becomesunknown, which requires type assertions or runtime checks when using the return value.Would it be possible or preferable to type the debounced function so that it preserves the original return type of func, instead of returning
unknown?Originally posted by @yujeong-jeon in #275 (comment)