We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9e94c0d commit 954e640Copy full SHA for 954e640
src/functions/utilities/call-if-exists.ts
@@ -27,11 +27,12 @@ import { isFunction } from "../typed";
27
* callIfExists(undefined); // => undefined
28
* callIfExists(null); // => undefined
29
*/
30
-export function callIfExists<T extends (...args: unknown[]) => ReturnType<T>>(
+// eslint-disable-next-line @typescript-eslint/no-explicit-any
31
+export function callIfExists<T extends (...args: any[]) => any>(
32
callback: T | undefined | null,
33
...args: Parameters<T>
34
): ReturnType<T> | undefined {
35
if (isFunction(callback)) {
- return callback(...args);
36
+ return callback?.(...args);
37
}
38
0 commit comments