TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

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

110 点作者 Rudeg将近 5 年前

8 条评论

Vanit将近 5 年前
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>
nojvek将近 5 年前
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 未加载
Lammy将近 5 年前
To save any fellow non-webdevs ten seconds, TS == TypeScript
评论 #24210249 未加载
hardwaregeek将近 5 年前
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 未加载
coding123将近 5 年前
I thought the tool to automatically migrate JS to TS was tsc --init and then set the flag to include js files.
评论 #24206970 未加载
评论 #24207539 未加载
goofballlogic将近 5 年前
It would be nice if we somehow had one to convert typescript back into _idiomatic_ JavaScript.
评论 #24208592 未加载
hartror将近 5 年前
We just finished our TS migration, I wonder if this would have helped.
cryptica将近 5 年前
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 未加载