If I had to choose between the two I would choose testing every time. Nothing replaces good tests.
I see, I've never used Typescript before. However, all the arguments presented by people recommending it never convinced me. I think it's kinda useless to switch for TS to only get that compile-time error hinting.
My point is why to switch if you can use the current JS ecosystem to write tests that ensure the outcome ( The business logic ) is valid, and check the types if you want to, rather than just adding that semantic analysis provided by TS which gives no extra magic just a hint for the source of type mismatching ( The same as testing ). Really Writing better JS using JS itself, alongside testing, is more appropriate IMO.
JS ecosystem is complicated enough, TS is fragmenting the community.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.