Forbids to include any
in a union. When any
is used in a union type, the resulting type is still any
.
Bad:
function f(x: string | any): void;
Good:
function f(x: string): void;
Or:
function f(x: any): void;
Or:
function f(x: string | object): void;
While the string
portion of this type annotation may look useful, it in fact offers no additional typechecking over simply using any
.