Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

Type annotations can only be used in TypeScript files

$
0
0

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??


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>