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"

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

  1. Thanks for your marvelous posting! I seriously
    enjoyed reading it, you are a great author. I will
    be sure to bookmark your blog and will eventually come back
    down the road. I want to encourage one to continue your great writing, have a nice afternoon!

    Reply
  2. i need a private loan lender, i need loan please help me. i need a loan shark online need loan now i own my home outright and need a loan i need a large loan with bad credit, cash advance settlement loans, cash advance loans, cash advance loans, 6 month cash advance loans. Money management describes banking, designed for companies.

    Reply