Function guardNonEmptyArrayValues

  • Given a Type Guard, returns a Type Guard that checks if the given value is an array and if the value of the array matches the given Type Guard.

    Example

    import { guardArrayValues } from 'type-guard-helpers';

    const isStringArray = guardArrayValues(
    (value: unknown): value is string =>
    typeof value !== 'string'
    );

    const test = {} as unknown;
    if (isStringArray(test)) {
    test; // test: readonly string[]
    }

    Type Parameters

    Parameters

    • guard: Guard

    Returns TypeGuardFn<readonly GuardTypeInput<Guard>[], readonly [GuardType<Guard>, GuardType<Guard>]>

Generated using TypeDoc