Don't inculde null
or undefined
in a union. Instad, wrap the type in Maybe
.
This rule aims to ensure that we don't treat null
and undefined
differently.
Autofixer available.
Examples of incorrect code for this rule:
const x: string | null = "hello";
Examples of correct code for this rule:
const x: Maybe<string> = "hello";
With third-party software that needs to differentiate between null
and undefined
.