TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ts-migrate: tool to automatically migrate JavaScript projects to TS

110 pointsby Rudegalmost 5 years ago

8 comments

Vanitalmost 5 years ago
I feel like this should be linking to the associated blog post that actually explains what we&#x27;re looking at.<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;airbnb-engineering&#x2F;ts-migrate-a-tool-for-migrating-to-typescript-at-scale-cd23bfeb5cc" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;airbnb-engineering&#x2F;ts-migrate-a-tool-for-...</a>
nojvekalmost 5 years ago
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.
评论 #24207778 未加载
Lammyalmost 5 years ago
To save any fellow non-webdevs ten seconds, TS == TypeScript
评论 #24210249 未加载
hardwaregeekalmost 5 years ago
I&#x27;ve wondered if you could run JS code, keep track of runtime types, and generate interfaces off of that. Of course the program wouldn&#x27;t know what to name the interface, but it&#x27;s still better than nothing.
评论 #24208449 未加载
评论 #24208406 未加载
coding123almost 5 years ago
I thought the tool to automatically migrate JS to TS was tsc --init and then set the flag to include js files.
评论 #24206970 未加载
评论 #24207539 未加载
goofballlogicalmost 5 years ago
It would be nice if we somehow had one to convert typescript back into _idiomatic_ JavaScript.
评论 #24208592 未加载
hartroralmost 5 years ago
We just finished our TS migration, I wonder if this would have helped.
crypticaalmost 5 years ago
This tool is ridiculous and less than useless. Can&#x27;t anyone else see how ridiculous of an idea it is to add types automatically? Isn&#x27;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&#x27;t believe I even have to explain myself. I thought static typing was meant to protect the code&#x27;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.
评论 #24210336 未加载
评论 #24210268 未加载