Type alias NestedPaths<Type, Depth>

NestedPaths<Type, Depth>: Depth["length"] extends 8
    ? []
    : Type extends string | number | bigint | boolean | Date | RegExp | Buffer | Uint8Array | ((...args) => any) | {
            _bsontype: string;
        }
        ? []
        : Type extends ReadonlyArray<infer ArrayType>
            ? [] | [number, ...NestedPaths<ArrayType, [...Depth, 1]>]
            : Type extends Map<string, any>
                ? [string]
                : Type extends object
                    ? {
                        [Key in Extract<keyof Type, string>]: Type[Key] extends Type
                            ? [Key]
                            : Type extends Type[Key]
                                ? [Key]
                                : Type[Key] extends ReadonlyArray<infer ArrayType>
                                    ? Type extends ArrayType
                                        ? [Key]
                                        : ArrayType extends Type
                                            ? [Key]
                                            : [Key, ...NestedPaths<Type[Key], [...Depth, 1]>]
                                    : [Key, ...NestedPaths<Type[Key], [...Depth, 1]>] | [Key]
                    }[Extract<keyof Type, string>]
                    : []

returns tuple of strings (keys to be joined on '.') that represent every path into a schema /v7.0/tutorial/query-embedded-documents/返回字符串元组(要在'.'上联接的键),这些字符串表示架构/v7.0/tutorial/query-embedded-documents/中的每个路径/

Type Parameters

  • Type

  • Depth extends number[]

Remarks

Through testing we determined that a depth of 8 is safe for the typescript compiler and provides reasonable compilation times. 通过测试,我们确定深度为8对于typescript编译器是安全的,并且提供了合理的编译时间。This number is otherwise not special and should be changed if issues are found with this level of checking. 此编号在其他方面并不特殊,如果在该级别的检查中发现问题,则应进行更改。Beyond this depth any helpers that make use of NestedPaths should devolve to not asserting any type safety on the input.超过这个深度,任何使用NestedPaths的助手都应该转变为不在输入上断言任何类型安全性。

Generated using TypeDoc