3 ms·
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 i
by hardwaregeek 6y ago
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.
- agumonkey 6y agoThis 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.
- jrib 6y agoGenerating starting points for interface definitions based on runtime logs does sound like a good idea. 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 https://github.com/instagram/MonkeyType