Type alias ValueMatchingPath<NestedObj, Path>
Value
Matching
Path
<NestedObj, Path>: string extends Path ? any : object extends NestedObj ? any : NestedObj extends readonly (infer SingleValue
)[] ? Path extends `${string}.${infer NextPath
}` ? NextPath extends AllPathsOf<NestedObj[number]> ? ValueMatchingPath<NestedObj[number], NextPath> : never : SingleValue : Path extends keyof NestedObj ? NestedObj[Path] : Path extends `${infer Key
}.${infer NextPath
}` ? Key extends keyof NestedObj ? NextPath extends AllPathsOf<NestedObj[Key]> ? ValueMatchingPath<NestedObj[Key], NextPath> : never : never : never
Type Parameters
-
NestedObj
-
Path extends AllPathsOf<NestedObj>
给定子路径和嵌套对象,获取子路径对应的 value 类型