/** * 定义类,并且把方法混入类的原型中 * 用以实现把类的方法实现和类的定义分离,方法可以实现在其他文件中 * * @example * * ```ts * import {speak} from './sub/speak'; * import {fly} from './sub/fly'; * let Animal = defineClass( * class Animal { constructor(public name: string) {}}, * { speak, fly } * ); * ``` * * @param classBase 基类构造函数 * @param methods 要混入的方法对象 * @returns 混合后的类构造函数 */ export declare function defineClass>(classBase: TBase, methods: TMethods): { new (...args: ConstructorParameters): Expand & TMethods>; } & TBase; export type Constructor = new (...args: any[]) => T; /** * 展开类型,用于优化类型提示 * Expand type for better type hints */ type Expand = T extends infer O ? { [K in keyof O]: O[K]; } : never; export {}; //# sourceMappingURL=defineClass.d.ts.map