import { Extends } from '../../commonness/Extends'; import { If } from '../../commonness/If'; /** * * Utility type to deeply omit properties from an object by a string path * * 문자열 경로로 객체에서 속성을 깊이 제거하는 유틸리티 타입 * * @param O Object type to omit properties from / 속성을 제거할 객체 타입 * * @param K String path to omit properties from / 속성을 제거할 문자열 경로 * * @returns Object with omitted properties / 속성이 제거된 객체 * * @example * * type obj = { * person: { * name: string; * age: { * value: number; * }; * }; * }; * * type cases = [ * Expect, {}>>, * Expect, { person: { age: { value: number } } }>>, * Expect, { person: { name: string; age: {} } }>>, * Expect, obj>>, * ] * * @link https://www.utilscript.site/docs/usage-object/deep-omit * */ export type DeepOmit, K extends string> = K extends keyof O ? Omit : { [P in keyof O]: K extends `${infer Key}.${infer Rest}` ? If, O[Key] extends Record ? DeepOmit : O[P], O[P]> : O[P]; };