Caveat, you kinda have to already be thinking about types while writing JS for this to work. Highly dynamic code can be much easier to write in TS from scratch than rewrite from JS.