You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
416 B
TypeScript
20 lines
416 B
TypeScript
type Join<K, P> = K extends string | number
|
|
? P extends string | number
|
|
? `${K}.${P}`
|
|
: never
|
|
: never;
|
|
|
|
type Paths<T> = T extends object
|
|
? {
|
|
[K in keyof T]-?: K extends string | number
|
|
? T[K] extends object
|
|
? `${K}` | Join<K, Paths<T[K]>>
|
|
: `${K}`
|
|
: never;
|
|
}[keyof T]
|
|
: never;
|
|
|
|
export type ValidationErrors<T extends Record<string, unknown>> = Partial<
|
|
Record<Paths<T>, string[]>
|
|
>;
|