Is there a way for the typescript compiler to throw an error when using the "any" type explicitly?

I am trying to make my code as strict as possible with TS. Is there a way to make the following declaration using "any" as a type to throw an error since it should be a "string" type?

const foo: any = "bar"

56 thoughts on “Is there a way for the typescript compiler to throw an error when using the "any" type explicitly?”