dyna-record
    Preparing search index...

    Type Alias TypeAtSegment<T, S>

    TypeAtSegment: S extends `${infer Name}[${number}]`
        ? NonNullable<TypeAtSegment<T, Name>> extends readonly (infer Element)[]
            ? Element
            : never
        : S extends keyof T ? T[S] : never

    The type one path segment names: a field of T, or — where the segment carries indexes — the element that indexing that field reaches.

    NonNullable is applied before stepping into the element, for the reason TypeAtDotPath applies it between segments: a nullable List is declared Element[] | undefined, which as a union does not match the array pattern, and an element of a List that is set is defined. Without it the index resolved to never and the key fell back to the stored form.

    Type Parameters

    • T

      The type the segment is read against.

    • S extends string

      The segment, with any indexes still attached.