Lint Rules

noExplicitAny (since v10.0.0)

Disallow the any type usage

Examples

Invalid

let variable: any = 1;
nursery/noExplicitAny.js:1:15 lint/nursery/noExplicitAny ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Unexpected any. Specify a different type.
  
  > 1 │ let variable: any = 1;
                 ^^^
    2 │ 
  
class SomeClass {
  message: Array<Array<any>>;
}
nursery/noExplicitAny.js:2:24 lint/nursery/noExplicitAny ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Unexpected any. Specify a different type.
  
    1 │ class SomeClass {
  > 2 │   message: Array<Array<any>>;
                          ^^^
    3 │ }
    4 │ 
  
function fn(param: Array<any>): void {}
nursery/noExplicitAny.js:1:26 lint/nursery/noExplicitAny ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

   Unexpected any. Specify a different type.
  
  > 1 │ function fn(param: Array<any>): void {}
                            ^^^
    2 │ 
  

Valid

let variable: number = 1;
let variable2 = 1;
class SomeClass {
  message: Array<Array<unknown>>;
}
function fn(param: Array<Array<unknown>>): Array<unknown> {}