type TEscape0 = Index extends `${infer Left}~0${infer Right}` ? `${Left}~${TEscape}` : Index; type TEscape1 = Index extends `${infer Left}~1${infer Right}` ? `${Left}/${TEscape}` : Index; type TEscape, Escaped1 extends string = TEscape1> = Escaped1; type IndicesReduce = (Pointer extends `${infer Left extends string}/${infer Right extends string}` ? Left extends '' ? IndicesReduce : IndicesReduce]> : [...Result, TEscape]); type TIndices> = Result; type TResolve = (Indices extends [infer Left extends string, ...infer Right extends string[]] ? Left extends keyof Value ? TResolve : undefined : Value); /** Type Level RFC 6901 Json Pointer Resolver */ export type XPointerGet, Result extends unknown = TResolve> = Result; export {};