Skip to content

complete/prefer-unknown-type-annotations

💼 This rule is enabled in the ✅ recommended config.

📝 Require variable type annotations over as unknown assertions.

🔧 This rule is automatically fixable by the --fix CLI option.

Require variable type annotations over as unknown assertions.

// Bad
const foo = JSON.parse(fooContents) as unknown;
// Good
const foo: unknown = JSON.parse(fooContents);

This rule is not configurable.