I've wondered if you could run JS code, keep track of runtime types, and generate interfaces off of that. Of course the program wouldn't know what to name the interface, but it's still better than nothing.
This is interesting, it would be great to make this a general tool. Extract invariants from untyped runs to generate tests/interfaces or else. Migrations would be smoother.
There's a similar project I'm aware of that uses runtime behavior to help create type annotations but for python: https://github.com/instagram/MonkeyType