Type Alias ValueTypeFromPath<T, P>
ValueTypeFromPath<T, P>: P extends keyof T ? T[P] : P extends `[].${infer ItemPath}` ? [T] extends [ObservableCollectionLike<infer ItemType>] ? ItemType extends Observable ? ItemPath extends keyof ItemType ? ItemType[ItemPath] : ValueTypeFromPath<ItemType, ItemPath> : unknown : unknown : P extends `${infer K}.${infer Rest}` ? K extends keyof T ? [T[K]] extends [Observable | undefined | null] ? Rest extends `[].${string}` ? ValueTypeFromPath<NonNullable<T[K]>, Rest> : ValueTypeFromPath<NonNullable<T[K]>, Rest> | (undefined extends T[K] ? undefined : never) : unknown : unknown : unknown
The type of the value at the end of a path created from ObservablePropertyPath or CollectionPropertyPath. Only intended for use with ObservablePropertyPath or CollectionPropertyPath.
Because the path was built with ObservablePropertyPath or CollectionPropertyPath, we know that the path is valid. We still have to build out the conditionals for the type system to understand what we are doing, but we don't need to handle the false cases.
This type uses recursion without any depth limits because the path is guaranteed to be valid and of a limited depth.
Note: This is a complex recursive type that should only be used for function definitions related to the observable watch system. It is not intended to be used for general purposes and should not be used by casts or other type manipulations.