PathToType - Nested Path Typing

Hard

Create 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.