Closed
Description
Hi, I ran into an issue where the types don't seem to be inferred correctly. Consider this:
interface ITestHandler { (a: string, ...args: any[]) }
interface ITestHandlers { [index: string]: ITestHandler; }
class Test { Events: ITestHandlers; }
var t = new Test();
t.Events = {
handler1: (a) => { }, // <= this works fine, 'a' is 'string'
handler2: (a, b: string) => { } // <= 'a' is 'any', but 'b' is optional in the interface!
};
I expect "a" for "handler2" to be "string", but instead it is "any". Shouldn't "a" be interred from the signature, since the "args" are of type "any", which should match any type?
Thanks.