eslint-plugin

@masknet/type/no-force-cast-via-top-type

Disallowing cast a type T to unrelated or incompatible type Q via T as any as Q

Rule Details

Don’t cast this expression to another type by as any as T or as unknown as T.

This is highly like an error.

If you have a good reason to do this, please ignore this error and provide a comment about why this is type safe.

:x: Incorrect

const foo = T as any as Q
const foo = T as unknown as Q

Attributes