• P.set(subpattern) takes a sub pattern and returns a pattern that matches sets if all their elements match the sub pattern.

    Read P.set documentation on GitHub

    Type Parameters

    • input

    Returns Chainable<SetP<input, unknown>>

    Example

    match(value)
    .with({ users: P.set(P.string) }, () => 'will match Set<string>')
  • Type Parameters

    • input
    • const pattern extends readonly [] | readonly [unknown, unknown] | readonly [unknown, unknown] | {
          [k: string]: unknown;
      } | Primitives | UnknownMatcher | readonly UnknownPattern[] | readonly [UnknownPattern, UnknownPattern] | readonly [UnknownPattern, UnknownPattern] | PatternMatcher<WithDefault<UnwrapSet<input>, unknown>> | {
          readonly [k in string | number | symbol]?: Pattern<Readonly<MergeUnion<Exclude<WithDefault<UnwrapSet<input>, unknown>, (readonly any[] | Primitives | Map<any, any> | Set<any>)>>>[k]>
      }

    Parameters

    Returns Chainable<SetP<input, pattern>>