Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Latest commit

 

History

History
27 lines (19 loc) · 466 Bytes

no-any-union.md

File metadata and controls

27 lines (19 loc) · 466 Bytes

no-any-union

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.