TypeScript/tests/cases/compiler/functionSubtypingOfVarArgs.ts
2014-07-12 17:30:19 -07:00

14 lines
333 B
TypeScript

class EventBase {
private _listeners = [];
add(listener: (...args: any[]) => void): void {
this._listeners.push(listener);
}
}
class StringEvent extends EventBase { // should work
add(listener: (items: string) => void ) { // valid, items is subtype of args
super.add(listener);
}
}