Do Machine Learning Models Produce TypeScript Types That Type Check?
Ming-Ho Yee, Arjun Guha

TL;DR
This paper introduces TypeWeaver, a tool for automatic TypeScript type migration that integrates machine learning models to produce type-checked code, showing promising results on real-world JavaScript packages.
Contribution
We present TypeWeaver, a versatile type migration tool that supports multiple ML models and automates key steps for type annotation insertion and validation.
Findings
21% of packages type check with the best model
69% of files type check successfully
Type prediction accuracy does not directly correlate with type check success
Abstract
Type migration is the process of adding types to untyped code to gain assurance at compile time. TypeScript and other gradual type systems facilitate type migration by allowing programmers to start with imprecise types and gradually strengthen them. However, adding types is a manual effort and several migrations on large, industry codebases have been reported to have taken several years. In the research community, there has been significant interest in using machine learning to automate TypeScript type migration. Existing machine learning models report a high degree of accuracy in predicting individual TypeScript type annotations. However, in this paper we argue that accuracy can be misleading, and we should address a different question: can an automatic type migration tool produce code that passes the TypeScript type checker? We present TypeWeaver, a TypeScript type migration tool…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsSoftware Engineering Research · Advanced Malware Detection Techniques · Software Engineering Techniques and Practices
