function assertInstanceOf
assertInstanceOf<T extends AnyConstructor>(actual: unknown,expectedType: T,msg?): asserts actual is GetConstructorType<T>Deprecated
(will be removed after 1.0.0) Import from https://deno.land/std/assert/assert_instance_of.ts instead.
Make an assertion that obj is an instance of type.
If not then throw.
Examples
Example 1
Example 1
import { assertInstanceOf } from "@std/testing/asserts"; assertInstanceOf(new Date(), Date); // Doesn't throw assertInstanceOf(new Date(), Number); // Throws
Type Parameters
T extends AnyConstructorParameters
Return Type
asserts actual is GetConstructorType<T>