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

React Native with typescript doesn't detect the incorrect types

$
0
0

I'm working on RN with Typescript. By using the official instruction I was managed to add .tsx and .ts file but the main problem I faced is that RN doesn't detect the incorrect types in the files at all. For ex.

At the beginning of App.tsx I added the wrong TS statement.

let a: number = 5;
a = "test"

When I added it to the standard React app (for web) the TS compiler shows me

Type '"test"' is not assignable to type 'number'. TS2322

But when I did the same in the case of RN, it just compiles and didn't show any warnings/errors, etc. The app is simply started on the emulator like everything is fine.

It's the first time when I'm trying to use RN with Typescript. Before I used only WEB apps + typescript so that why I'm wondering is such behavior correct? How can I enable the type-checking in the case of React native?

P.S. I even tried this one. The same behavior.

Thanks for any help.


Viewing all articles
Browse latest Browse all 6211

Trending Articles



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