• P.instanceOf(SomeClass) is a pattern matching instances of a given class.

    Read the documentation for P.instanceOf on GitHub

    Type Parameters

    • T extends AnyConstructor

    Parameters

    • classConstructor: T

    Returns Chainable<GuardP<unknown, InstanceType<T>>>

    Example

    .with(P.instanceOf(SomeClass), () => 'will match on SomeClass instances')