Interface de Função Datilografada
Por que o Typescript não me avisa que a função que estou definindo não corresponde à declaração da interface, mas me avisa se eu tentar invocar a função.
interface IFormatter {
(data: string, toUpper : boolean): string;
};
//Compiler does not flag error here.
var upperCaseFormatter: IFormatter = function (data: string) {
return data.toUpperCase();
}
upperCaseFormatter("test"); //but does flag an error here.