Type annotations can only be used in TypeScript files.ts(8010) on React-Native CLI Startup

Please provide all the information requested. Issues that do not follow this format are likely to stall.

Description

I have created like 2 starter project in ReactNative using npx react-native init [projectName], and that error in the title always comes with the starter code, precisely on line 27.

React Native version:

System:
OS: Windows 10 10.0.18362
CPU: (2) x64 Intel(R) Celeron(R) 2957U @ 1.40GHz
Memory: 1.76 GB / 7.89 GB
Binaries:
Node: 12.17.0 – C:\Program Files\nodejs\node.EXE
Yarn: 1.22.4 – C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm: 6.14.4 – C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
IDEs:
Android Studio: Version 3.6.0.0 AI-192.7142.36.36.6392135
Languages:
Java: javac 12
Python: Not Found
npmPackages:
@react-native-community/cli: Not Found
react: 16.11.0 => 16.11.0
react-native: 0.62.2 => 0.62.2
npmGlobalPackages:
react-native: Not Found

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Create a new react native project
  2. Open the starter code from any editor, i use VScode.
  3. Go to App.js and scroll to line 27.
  4. Hold on a little bit then the error would occur.

Expected Results

Since it is a starter code from the react-native team, which helps new developers to understand the codebase and how it works, that error should not be there. It can scare a new developer coming into ReactNative.

Snack, code example, screenshot, or link to a repository:

react_errorr

2 thoughts on “Type annotations can only be used in TypeScript files.ts(8010) on React-Native CLI Startup