I feel like this should be linking to the associated blog post that actually explains what we're looking at.<p><a href="https://medium.com/airbnb-engineering/ts-migrate-a-tool-for-migrating-to-typescript-at-scale-cd23bfeb5cc" rel="nofollow">https://medium.com/airbnb-engineering/ts-migrate-a-tool-for-...</a>
If I understand correctly, they convert the js file to .ts file, ask tsc for error diagnostics and automatically apply transformations to resolve those errors when they can.<p>Yep that’s how I’d do it too. I wrote a simpler version when doing a tsc upgrade to resolve a whole bunch of errors. It parses the tsc errors and does simple string replaces.<p>Has anyone played with the tool to report how good it is?<p>I remember v8 did an experiment back in the day where it would run code and profile the input parameters and output of functions and automatically generate typescript types.
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 tool is ridiculous and less than useless. Can't anyone else see how ridiculous of an idea it is to add types automatically? Isn't the whole point of static typing to allow the human developer to specify what the types should be? If a machine could resolve the type integrity issue automatically from dynamically typed code (which is what this tool claims to do), why do we need this tool to physically insert type annotations into the code to begin with? I can't believe I even have to explain myself. I thought static typing was meant to protect the code's integrity?<p>Clearly this tool is undeniable proof that static typing exists merely to satisfy human ego and neuroticism and has nothing to do with logical integrity... Since this tool itself supposedly proves that this integrity can be derived automatically from dynamically typed code. This tool is a paradox, a blatant logical contradiction.<p>If this tool does work as advertised, then it proves the uselessness of static typing and thus, by extension, this tools proves its own uselessness.<p><i></i>EDIT<i></i> I removed a potentially offensive remark from my comment. This makes zero sense to me is my point.