//我在codeplex上创建了一个问题:https://typescript.codeplex.com/workitem/2112
declare module TestBug {
interface ListIterator<T, TResult> {
(value: T, index: number, list: T[]): TResult;
}
interface testcase<T> {
func1<T2>(iterator: ListIterator<T, T2[]>): string;
func1<T2>(iterator: ListIterator<T, T2>): number;
func2<T2>(iterator: (value: T, index: number, list: T[]) => T2[]): string;
func2<T2>(iterator: ListIterator<T, T2>): number;
}
}
var tc: TestBug.testcase<string>;
//This returns as a number, but should match first implementation of func1 and return a string
var result1: number = tc.func1(v=> [v]);
//When not using the typed function interface... it seems to work fine?
var result2: string = tc.func2(v=> [v]);
答案 0 :(得分:2)
打字稿的人回复了我打开的问题。这是一个错误......但它已在开发分支中修复。所以它应该在下一个版本中修复。