js 'types' can only be used in a .ts file - Visual Studio Code using @ts-check
I'm using flow with vscode but had the same problem. I solved it with these steps:
Install the extension Flow Language Support
Disable the built-in TypeScript extension:
- Go to Extensions tab
- Search for @builtin TypeScript and JavaScript Language Features
- Click on Disable
Use "javascript.validate.enable": false
in your VS Code settings, It doesn't disable ESLINT. I use both ESLINT & Flow. Simply follow the instructions Flow For Vs Code Setup
Adding this line in settings.json. Helps"javascript.validate.enable": false
For anyone who lands here and all the other solutions did not work give this a try. I am using typescript + react and my problem was that I was associating the files in vscode as javascriptreact
not typescriptreact
so check your settings for the following entries.
"files.associations": { "*.tsx": "typescriptreact", "*.ts": "typescriptreact" },