Type annotations can only be used in TypeScript files

I have created a new react-native project using:

npx react-native init

But on App.js there is an error here:

const App: () => React$Node = () => {
  return (
...
)}

There is a red underline in "() => React$Node"

And the error is:

Type annotations can only be used in TypeScript files

I know that this can be fixed by just using "const App = () => { ", but I remember that I have created some other projects before that would not have this error when created. I noticed that this started to happen only after I created a project with template typescript. Now every project I create start like this, and I don't think this is the only thing on the code that is different, because I'm finding a lot of odd errors that wouldn't happen before. The project now will only render right if I use typescript, even if I change this line.

My question is: How can I go back to when the project would not require typescript to work??



Read more here: https://stackoverflow.com/questions/66266038/type-annotations-can-only-be-used-in-typescript-files

Content Attribution

This content was originally published by Aryalie at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: