Commit 6601ed6a authored by nanahira's avatar nanahira

fix

parent dabb208b
...@@ -7,22 +7,31 @@ export type RecursiveKeyOf<TObj extends Record<string, any>> = { ...@@ -7,22 +7,31 @@ export type RecursiveKeyOf<TObj extends Record<string, any>> = {
>; >;
}[keyof TObj & string]; }[keyof TObj & string];
type RecursiveKeyOfInner<TObj extends Record<string, any>> = { type RecursiveKeyOfInner<
TObj extends Record<string, any>,
UsedTypes = never,
> = {
[TKey in keyof TObj & string]: RecursiveKeyOfHandleValue< [TKey in keyof TObj & string]: RecursiveKeyOfHandleValue<
TObj[TKey], TObj[TKey],
`.${TKey}` `.${TKey}`,
UsedTypes
>; >;
}[keyof TObj & string]; }[keyof TObj & string];
type RecursiveKeyOfHandleValue<TValue, Text extends string> = TValue extends type RecursiveKeyOfHandleValue<
TValue,
Text extends string,
UsedTypes = never,
> = TValue extends
| Function | Function
| ((...args: any[]) => any) | ((...args: any[]) => any)
| (new (...args: any[]) => any) | (new (...args: any[]) => any)
| UsedTypes
? never ? never
: TValue extends Date | string | number | boolean : TValue extends Date | string | number | boolean
? never // Text ? never // Text
: TValue extends (infer TItem)[] : TValue extends (infer TItem)[]
? Text | `${Text}${RecursiveKeyOfInner<TItem>}` ? Text | `${Text}${RecursiveKeyOfInner<TItem, UsedTypes | TItem>}`
: TValue extends Record<string, any> : TValue extends Record<string, any>
? Text | `${Text}${RecursiveKeyOfInner<TValue>}` ? Text | `${Text}${RecursiveKeyOfInner<TValue, UsedTypes | TValue>}`
: never; // Text; : never; // Text;
...@@ -15,9 +15,17 @@ export enum Gender { ...@@ -15,9 +15,17 @@ export enum Gender {
M = 'M', M = 'M',
} }
export class Page {
id: number;
name: string;
book: Book;
}
export class Book { export class Book {
id: number; id: number;
name: string; name: string;
user: User;
pages: Page[];
} }
@Entity() @Entity()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment