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

FlexType: A Plug-and-Play Framework for Type Inference Models
复制标题

DOI:
10.1145/3551349.3559527
复制
发表时间:
2022-10
期刊:
Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering
影响因子:
--
通讯作者:
Sivani Voruganti;Kevin Jesse;Prem Devanbu
Sivani Voruganti;Kevin Jesse;Prem Devanbu
中科院分区:
其他
文献类型:
--
作者:
Sivani Voruganti;Kevin Jesse;Prem Devanbu

文献摘要

相似文献

TypeScript中的类型在正确使用变量和API方面发挥着重要作用。使用显式类型注释可以避免类型错误,如变量或函数误用。在这项工作中,我们介绍了FlexType,这是一个IDE扩展,可以在JavaScript和TypeScript上使用,以交互或自动方式推断类型。我们在JavaScript中使用FlexType进行实验,以确定如果要将顶级JavaScript项目迁移到TypeScript,FlexType可以解析多少类型。FlexType能够以高精度和高置信度注释56.69%的所有类型,包括来自模块的本地和导入类型。除了自动推理之外,我们相信交互式Visual Studio Code扩展在TypeScript和JavaScript中本质上是有用的,特别是当解析类型对开发人员来说是繁重的时候。源代码可以在GitHub 1上找到,视频演示可以在https://youtu.be/4dPV05BWA8A上找到。
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 GitHub1 and a video demonstration at https://youtu.be/4dPV05BWA8A.