diff --git a/src/utils.ts b/src/utils.ts index 92df9755..77ce9d74 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -251,6 +251,13 @@ export type IsRecord = T extends object ? T : never : never + +/** + * Check if a type is a class type. + */ + +export type IsClass = T extends { new (...args: any[]): any } ? T : never + /** * Check if a type is a tuple. */ @@ -374,7 +381,9 @@ export type StructSchema = [T] extends [string | undefined | null] ? null : Struct : T extends object - ? T extends IsRecord + ? T extends IsClass + ? null + : T extends IsRecord ? null : { [K in keyof T]: Describe } : null