Why is this possible:
interface MyInterface{
aggregate: (Array) => Array<string>;
}
But not this:
interface MyInterface{
aggregate: (Array<string>) => Array<string>;
}
Because the first one does not do what it appears to do. Your intention was probably to define a function with a parameter of type Array. While in actuality you defined a function with a parameter named Array of type any
If you don't specify parameter types they are assumed to be any. You can be warned about this if you specify the noImplicitAny flag.
Please read the handbook.
TypeScript don't support writing function parameter type alone, you have to provide its parameter name.
interface MyInterface{
aggregate: (args: Array<string>) => Array<string>;
}