Firstly, the simplest problem to fix with typescript would be to remove the "any" type, with that in the language, it lets lazy developers be lazy and negates the fact that you have typing in the first place.
Secondly, and this is the difficult one to solve, the types can lie to you. Typescript would need to implement a runtime checking system, and i dont see how that can be done without significantly hampering performance and bundle size. I know you can do type guarding and the likes, but you can do that in regular JavaScript as well.