Rule: no-object-literal-type-assertion

Forbids an object literal to appear in a type assertion expression. Casting to any is still allowed.

Rationale

Always prefer const x: T = { ... }; to const x = { ... } as T;. The type assertion in the latter case is either unnecessary or hides an error. The compiler will warn for excess properties with this syntax, but not missing required fields. For example: const x: { foo: number } = {} will fail to compile, but const x = {} as { foo: number } will succeed.

Notes:
TS Only

Config

Not configurable.

Examples
"no-object-literal-type-assertion": true
Schema
null