class EventEmitter { static installTo(obj: object): void { //... } on() { /* ... */ } off() { /* ... */ } emit() { /* ... */ } fire() { /* ... */ } once() { /* ... */ } } interface EventEmitterMethods { on(): void; off(): void; emit(): void; fire(): void; once(): void; } // 定义LRU类 class LRU { constructor(options?: number | LRUOptions) { EventEmitter.installTo(this); } } // 用声明合并把EventEmitterMethods接口与LRU类合在一起 interface LRU extends EventEmitterMethods { } const lru = new LRU(); lru.on(); // 不再报错