Skip to main content

no-object-any

🚫 This rule is disabled in the ✅ recommended config.

Disallows declaring objects and arrays that do not have a type.

💭 This rule requires type information.

This is useful because the noImplicitAny TypeScript compiler flag does not always catch this pattern. If you want to purge all of the any from your codebase, you need this rule.

Rule Details​

// Bad
const myMap = new Map();

// Good
const myMap = new Map<string, string>();
// Bad
const myArray = [];

// Good
const myArray: string[] = [];

Options​

This rule is not configurable.

Resources​