From: Jérôme Benoit Date: Thu, 4 Apr 2024 09:23:40 +0000 (+0200) Subject: docs: refine code comment X-Git-Tag: v3.1.30~39 X-Git-Url: https://git.piment-noir.org/?p=poolifier.git;a=commitdiff_plain;h=5bbdaeff9b95f2ecb177394f869e9d0715e38e9e docs: refine code comment Signed-off-by: Jérôme Benoit --- diff --git a/src/utils.ts b/src/utils.ts index 88562ca3..c568a29a 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -198,18 +198,22 @@ export const max = (...args: number[]): number => * @param fn - The function to wrap. * @param context - The context to bind the function to. * @returns The wrapped function. + * + * @typeParam A - The function's arguments. + * @typeParam R - The function's return value. + * @typeParam C - The function's context. * @internal */ // eslint-disable-next-line @typescript-eslint/no-explicit-any -export const once = ( +export const once = ( fn: (...args: A) => R, - context: T + context: C ): ((...args: A) => R) => { let result: R return (...args: A) => { // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition if (fn != null) { - result = fn.apply(context, args) + result = fn.apply(context, args) ;(fn as unknown as undefined) = (context as unknown as undefined) = undefined }