Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native typescript Unexpected token in catch clause

I have a fully configured react native typescript project and everything is working as expected, but I have a strange issue:

I all of my catch blocks, since I have strict mode enabled, I have typescript errors like this one enter image description here

So the first obvious thing to do was to add any type to the error object

enter image description here

Ok, error gone. But at this point the problem in in RN bundler:

enter image description here

I am pretty sure that it's caused by some sort of wrong typescript configuration, but I really don't have any idea of what to check, any help?

like image 411
Apperside Avatar asked May 09 '26 00:05

Apperside


1 Answers

UPDATE:

Just updated some babel related packages and it works now 😅

@babel/core: ^7.6.2t --> ^7.12.9
@babel/runtime: ^7.6.2 --> ^7.12.5
metro-react-native-babel-preset: ^0.58.0 --> ^0.66.0
like image 155
Apperside Avatar answered May 11 '26 15:05

Apperside



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!