import { Extends } from '../../commonness/Extends'; import { If } from '../../commonness/If'; import { IsNever } from '../../commonness/IsNever'; import { Get } from '../Get'; type GetToObjectHelper = K extends keyof T ? Pick : K extends `${infer A}.${infer B}` ? A extends keyof T ? If, T[A], { [k in A]: GetToObjectHelper; }> : never : K extends keyof T ? { [k in K]: T[K]; } : never; /** * * Utility type to get a value from an object by a string path * * 문자열 경로로 객체에서 값을 가져오는 유틸리티 타입 * * @param T Object type to get the value from / 값을 가져올 객체 타입 * * @param K String path to get the value from / 값을 가져올 문자열 경로 * * @returns Value of the object at the path / 경로에 있는 객체의 값 * * @example * type cases = [ * Expect, { a: 1 }>>, * Expect, never>>, * Expect, never>>, * Expect, { a: { b: { c: 1 } } }>> * Expect, never>>, * ] * * @link https://www.utilscript.site/docs/usage-object/get-to-object * */ export type GetToObject = If, K>>, never, GetToObjectHelper>; export {};