mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
18 lines
502 B
TypeScript
18 lines
502 B
TypeScript
//// [tests/cases/compiler/eventEmitterPatternWithRecordOfFunction.ts] ////
|
|
|
|
//// [eventEmitterPatternWithRecordOfFunction.ts]
|
|
interface A {
|
|
emit(event: string, ...args: any[]): boolean;
|
|
}
|
|
|
|
type Args<F> = F extends (...args: infer A) => void ? A : never;
|
|
|
|
type EventMap = Record<string, Function>;
|
|
|
|
interface B<M extends EventMap> extends A {
|
|
emit<Event extends keyof M>(event: Event, ...args: Args<M[Event]>): boolean;
|
|
}
|
|
|
|
//// [eventEmitterPatternWithRecordOfFunction.js]
|
|
"use strict";
|