Skip to main content

Disallows calling an any type value (no-unsafe-call)

Despite your best intentions, the any type can sometimes leak into your codebase. The arguments to, and return value of calling an any typed variable are not checked at all by TypeScript, so it creates a potential safety hole, and source of bugs in your codebase.

Rule Details

This rule disallows calling any variable that is typed as any.

Examples of code for this rule:

declare const anyVar: any;
declare const nestedAny: { prop: any };

anyVar();
anyVar.a.b();

nestedAny.prop();
nestedAny.prop['a']();

new anyVar();
new nestedAny.prop();

anyVar`foo`;
nestedAny.prop`foo`;

Attributes

  • โœ… Recommended
  • ๐Ÿ”ง Fixable
  • ๐Ÿ’ญ Requires type information