This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type CombineAll<T> = T extends {[name in keyof T]: infer Type} ? Type : never | |
type PropertyNameMap<T, IncludeIntermediate extends boolean> = { | |
[name in keyof T]: T[name] extends object ? ( | |
SubPathsOf<name, T, IncludeIntermediate> | (IncludeIntermediate extends true ? name : never) | |
) : name | |
} | |
type SubPathsOf<key extends keyof T, T, IncludeIntermediate extends boolean> = ( | |
`${string & key}.${string & PathsOf<T[key], IncludeIntermediate>}` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Converts a type string from a snake_case string to PascalCase. | |
* This will convert all snake case strings including strings with no underscores, or many | |
*/ | |
export type PascaleFromSnake<String extends string> = String extends `${infer First}_${infer Rest}` ? `${Capitalize<Lowercase<First>>}${PascaleFromSnake<Rest>}` : Capitalize<Lowercase<String>> | |
/** | |
* Converts a type string from a snake_case string to camelCase. | |
* This will convert all snake case strings including strings with no underscores, or many | |
*/ |