Skip to main content
Module

x/unknownutil/is.ts>isFunction

🦕 A lightweight utility pack for handling unknown type
Go to Latest
function isFunction
import { isFunction } from "https://deno.land/x/unknownutil@v3.18.0/is.ts";

Return true if the type of x is function.

import { is } from "@core/unknownutil";

const a: unknown = () => {};
if (is.Function(a)) {
  // a is narrowed to (...args: unknown[]) => unknown
  const _: ((...args: unknown[]) => unknown) = a;
}

Parameters

x: unknown

Returns

x is (...args: unknown[]) => unknown