@pleisto/active-support
    Preparing search index...

    Type Alias narrow<input, pattern>

    narrow: ExtractPreciseValue<input, InvertPattern<pattern, input>>

    P.narrow<Input, Pattern> will narrow the input type to only keep the set of values that are compatible with the provided pattern type.

    Read the documentation for P.narrow on GitHub

    Type Parameters

    • input
    • pattern
    type Input = ['a' | 'b' | 'c', 'a' | 'b' | 'c']
    const Pattern = ['a', P.union('a', 'b')] as const

    type Narrowed = P.narrow<Input, typeof Pattern>
    // ^? ['a', 'a' | 'b']