Skip to main content
Module

x/silicon/deps.ts>isInstanceOf

Deno module to generate images from source code using Aloxaf/silicon.
Latest
function isInstanceOf
import { isInstanceOf } from "https://deno.land/x/silicon@v1.0.0/deps.ts";

Return true if the type of x is instance of ctor.

import is from "./is.ts";

const a: unknown = new Date();
if (is.InstanceOf(Date)(a)) {
  // a is narrowed to Date
  const _: Date = a;
}

Type Parameters

T extends new (...args: any) => unknown

Returns

Predicate<InstanceType<T>>