Pattern<a>: unknown extends a
    ? UnknownPattern
    : KnownPattern<a>

Pattern<a> is the generic type for patterns matching a value of type a. A pattern can be any (nested) javascript value.

They can also be wildcards, like P._, P.string, P.number, or other matchers, like P.when(predicate), P.not(pattern), etc.

Read the documentation for P.Pattern on GitHub

Type Parameters

  • a

Example

const pattern: P.Pattern<User> = { name: P.string }