I am declaring a typescript variable as follows:
let foo: any = this.someFunc(someArg);
someFunc is a function whose return type matches foo's type:
public someFunc(arg: any): any {
return {};
}
The return type is 'any' but it also could have been any other type.
Given that foo declaration may have been expressed without specifying the type:
let foo = this.someFunc(someArg);
Should the first declaration example be considered wrong or an error?
I am currently being told in a pull request that this is wrong because it constitutes a repetition.
In my view both uses are fine, the first one is more readable and enforces the return type which is assigned to the declared variable.
In typescript code samples I have seen both notations.