Currently we are migrating our codebase to typescript and we have many places with any type. So I am trying to enforce explicit setting variables as any.
Here is example snippet.
const a: string = 'h';
const b: any = 4;
const message = a || b;
// Here I would like to get warning that I am assigning any to the message,
// so I would have to write const message: any = a || b;
function say(x: string) {
console.log(x);
}
say(message);
I am aware about the tslint rule typedef
(It requires to typedef all variables and not only in cases of any), also no-unsafe-any
(doesn't work in this case).
Is there a way to require explicitly define any type if you are trying to assign any to it?