import type Model from 'src/model' export type TGeneric = Record export type XGeneric = { [key: string]: T } & V export interface Plugin { (model: Model, config: TGeneric): void } export type Hook = | 'creating' | 'created' | 'updating' | 'updated' | 'saving' | 'saved' | 'deleting' | 'deleted' | 'restoring' | 'restored' | 'trashed' | 'forceDeleted' export type TFunction = ( ...args: TArgs ) => TReturn export type PrimitiveValue = | string | number | boolean | Date | string[] | number[] | boolean[] | Date[] | null | Buffer export type ReturnTypeOfMethod = T[K] extends ( ...args: any[] ) => infer R ? R : never export type SnakeToCamelCase = S extends `${infer T}_${infer U}` ? `${T}${Capitalize>}` : S // declare const model: ModelDecorator; export type CamelToSnakeCase = S extends `${infer T}${infer U}` ? U extends Uncapitalize ? `${Uncapitalize}${CamelToSnakeCase}` : `${Uncapitalize}_${CamelToSnakeCase}` : S export type FunctionPropertyNames = { [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never }[keyof T] export type RelationNames = FunctionPropertyNames extends infer R ? R extends `relation${infer P}` ? P extends 'sToData' | 'loaded' ? never : CamelToSnakeCase

: never : never export type MixinConstructor = new (...args: any[]) => T export type AbstractConstructor = abstract new ( ...args: any[] ) => T // Helper type: combine all mixin instance types into a single intersection export type MixinReturn< Base extends MixinConstructor, Mixins extends ((base: any) => any)[], > = Base extends MixinConstructor ? IntersectionOfInstances> & B : never export type InstanceTypeOfMixins any)[]> = T extends [ infer Head, ...infer Tail, ] ? Head extends (base: any) => infer R ? Tail extends ((base: any) => any)[] ? R | InstanceTypeOfMixins : R : never : never export type IntersectionOfInstances = ( U extends any ? (x: U) => any : never ) extends (x: infer I) => any ? I : never export interface DeepMixinFunction { any)[]> ( Base: MC, ...mixins: P ): MixinReturn }