Variables can be declared with or without types. Variables declared without a type will be implicitly typed if the declaration includes an
initialization, and the compiler then type-checks every usage of typed variables. On the other hand, a variable declared with the any
type explicitly instructs the compiler not to do any type-checking, which is risky.
The unknown type should be preferred over the any type if it’s not possible to have a better typing. any
fully disables type-checking allowing to do anything with the variable, while unknown requires to narrow the type before doing something
specific.
let a = 42; // implicitly typed to number let b: number = 42; // explicitly typed to number let c: any = 42; // Noncompliant
let a = 42; let b: number = 42; let c: number = 42;