Search code examples
javascripttypescriptvisual-studionestjstypescript-eslint

How to Clear this "Type annotations can only be used in TypeScript files.ts(8010)" error in VSCODE


I am using nest js as my backend and i get this type annotation error often. I am unable to solve this error. The file extension by default is .ts file. I even get this error when i use React with typecript. Is there any other options to solve this problem without disabling the validation.

enter image description here

I have tried disabling the typescript validation as some of the articles and Q&A suggest. But whats the use of disabling it when we use the typescript. I tried reinstalling the typecript and ESLInt too.


Solution

  • Make sure your language in the bottom right window angle is set to TS
    enter image description here


    What exactly you did to lose it? you haven't provided links to what you did