PathToType - Nested Path Typing
HardCreate type PathValue<T, P> for Hack Frontend that accepts an object and string path (e.g., "user.profile.hackFrontendLevel") and returns the type of the value at that path.
This is a real interview question from Yandex!
TypeScript•UTF-8
Run your code to see results.
Click the Run button above
PathToType - Nested Path Typing
HardCreate type PathValue<T, P> for Hack Frontend that accepts an object and string path (e.g., "user.profile.hackFrontendLevel") and returns the type of the value at that path.
This is a real interview question from Yandex!
Examples:
Input 1: PathValue<HackFrontendState, "user.profile.level">
Output 1: number
Output
Run your code to see results.