Type Alias IsReadonly<A, $Options>

IsReadonly<A, $Options>: TypePlusOptions.Merge<$Options, ArrayPlus.IsReadonly.DefaultOptions> extends infer O extends ArrayPlus.IsReadonly.Options
    ? IsNever<A, {
        $else: A extends any
            ? LooseArrayType<A, Readonly<A> extends A
                ? O["$then"]
                : O["$else"], O["$notArray"]>
            : never;
        $then: O["$never"];
    }>
    : never

🎭 predicate 🔢 customizable

Checks if A is a readonly array or tuple

Type Parameters

type R = IsReadonly<readonly string[]> // true
type R = IsReadonly<readonly [1, 2, 3, 4, 5]> // true

type R = IsReadonly<[1, 2, 3, 4, 5]> // false
type R = IsReadonly<readonly string[] | number> // boolean