TypeTensor - v0.1.0
    Preparing search index...

    Type Alias InferShape<A>

    InferShape: A extends readonly (infer T)[]
        ? A extends readonly [unknown, ...unknown[]]
            ? readonly [A["length"], ...InferShape<T>]
            : InferShape<T> extends readonly []
                ? readonly [number]
                : readonly [number, ...InferShape<T>]
        : readonly []

    Extract shape from nested array type

    Inverse of NestedArray - given a nested array, extract its shape.

    Type Parameters

    • A

      Nested array type

    type S1 = InferShape<number>;                    // readonly []
    type S2 = InferShape<[number, number, number]>; // readonly [3]
    type S3 = InferShape<[[number, number]]>; // readonly [1, 2]