assertInstanceOf
assertInstanceOf
Section titled “assertInstanceOf”Assertion function that checks if a value is an instance of a given class, with type-narrowing.
import { assertInstanceOf } from "@kensio/smartass";
const error: unknown = new Error("Boom");
assertInstanceOf(error, Error);
// error is now narrowed to ErrorSource
Section titled “Source”Source file: src/assert/instance-of/instance-of.assert.ts
