ASE2022

FlexType: A Plug-and-Play Framework for Type Inference Models

Sivani Voruganti, Kevin Jesse, Premkumar T. Devanbu

被引用 2 次

摘要

Types in TypeScript play an important role in the correct usage of variables and APIs. Type errors such as variable or function misuse can be avoided with explicit type annotations. In this work, we introduce FlexType, an IDE extension that can be used on both JavaScript and TypeScript to infer types in an interactive or automatic fashion. We perform experiments with FlexType in JavaScript to determine how many types FlexType could resolve if it were to be used to migrate top JavaScript projects to TypeScript. FlexType is able to annotate 56.69% of all types with high precision and confidence including native and imported types from modules. In addition to the automatic inference, we believe the interactive Visual Studio Code extension is inherently useful in both TypeScript and JavaScript especially when resolving types is taxing for the developer. The source code is available at GitHub 1 and a video demonstration at https://youtu.be/4dPV05BWA8A . CCS CONCEPTS • Computing methodologies → Machine learning; • Theory of computation → Type structures; • Software and its engineering → Integrated and visual development environments; Source code generation.