Type annotations can only be used in TypeScript files.ts

  1. install the extension Flow Language Support
  2. disable the built-in TypeScript extension:

How to disable built-in TypeScript:

  1. go to extensions tab
  2. search for @builtin TypeScript and JavaScript Language Features
  3. click on Disable