Hacker News new | ask | show | jobs
by hardwaregeek 2137 days 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.
2 comments

Generating 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

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.