Documentation
    Preparing search index...

    Type Alias LimitDepth<Key, Value, MaxDepth, Depth>

    LimitDepth: [Item<any, any, any, any>] extends [Value]
        ? MaxDepth extends Depth ? never : Key
        : [Collection<any, any, any>] extends [Value]
            ? MaxDepth extends Depth ? never : Key
            : Key

    Validates the Depth property against the MaxDepth and drops the key when both are the same.

    Since there is no arithmetic checks in TypeScript, we cannot check of Depth >= MaxDepth. We have to rely on Depth === MaxDepth and be careful about not incrementing the depth unnecessarily as that might make the entire check fail

    Type Parameters

    • Key
    • Value
    • MaxDepth extends number
    • Depth extends number