Do Developers Read Type Information? An Eye-Tracking Study on TypeScript
- URL: http://arxiv.org/abs/2602.04824v1
- Date: Wed, 04 Feb 2026 18:12:59 GMT
- Title: Do Developers Read Type Information? An Eye-Tracking Study on TypeScript
- Abstract summary: Statically-annotated types have been shown to aid developers in a number of programming tasks.<n>It is hypothesized that this is because developers use type annotations as in-code documentation.
- Score: 4.249448869949738
- License: http://creativecommons.org/licenses/by/4.0/
- Abstract: Statically-annotated types have been shown to aid developers in a number of programming tasks, and this benefit holds true even when static type checking is not used. It is hypothesized that this is because developers use type annotations as in-code documentation. In this study, we aim to provide evidence that developers use type annotations as in-code documentation. Understanding this hypothesized use will help to understand how, and in what contexts, developers use type information; additionally, it may help to design better development tools and inform educational decisions. To provide this evidence, we conduct an eye tracking study with 26 undergraduate students to determine if they read type annotations during code comprehension and bug localization in the TypeScript language. We found that developers do not look directly at lines containing type annotations or type declarations more often when they are present, in either code summarization or bug localization tasks. The results have implications for tool builders to improve the availability of type information, the development community to build good standards for use of type annotations, and education to enforce deliberate teaching of reading patterns.
Related papers
- Type Hints in Python Libraries and Frameworks: An Empirical Analysis of Adoption and Maintenance [0.29332247106953097]
We investigate the adoption, usage, maintenance, and rationale of type hints in Python libraries and frameworks.<n>Of the analyzed repositories, 91% of libraries use type hints at least once, although adoption is inconsistent.<n>When modified, annotations tend to migrate to more expressive types.
arXiv Detail & Related papers (2026-09-02T16:15:09Z) - Automating Just-In-Time Python Type Annotation Updating [26.292549325956045]
We argue that obsolete type annotations can be reduced and even avoided by automatically updating type annotations alongside code changes.<n>TypeUp can automatically generate new type annotations based on the old type annotations and corresponding code changes.
arXiv Detail & Related papers (2026-07-10T02:53:36Z) - Type-Less yet Type-Aware Inductive Link Prediction with Pretrained Language Models [47.6332883113148]
We introduce TyleR, a Type-less yet type-awaRe approach for subgraph-based inductive link prediction.<n>We show that TyleR outperforms state-of-the-art baselines in scenarios with scarce type annotations and sparse graph connectivity.
arXiv Detail & Related papers (2025-09-30T13:23:02Z) - Type-Constrained Code Generation with Language Models [51.03439021895432]
We introduce a type-constrained decoding approach that leverages type systems to guide code generation.<n>For this purpose, we develop novel prefix automata and a search over inhabitable types, forming a sound approach to enforce well-typedness on LLM-generated code.<n>Our approach reduces compilation errors by more than half and significantly increases functional correctness in code synthesis, translation, and repair tasks.
arXiv Detail & Related papers (2025-04-12T15:03:00Z) - Toward a Corpus Study of the Dynamic Gradual Type [0.0]
This paper reports on an in-progress corpus study of the dynamic type in Python, targeting 221 GitHub projects that use the mypy type checker.<n>The study reveals eight patterns-of-use for the dynamic type, which have implications for future refinements of the mypy type system and for tool support to encourage precise type annotations.
arXiv Detail & Related papers (2025-03-11T22:18:51Z) - How Do Developers Use Type Inference: An Exploratory Study in Kotlin [3.382017614888546]
Kotlin is the default language for Android development, one of the largest software marketplaces.
We conduct a large-scale empirical study using Boa, a tool for mining software repositories.
Our findings reveal that type inference is frequently employed for local variables and variables with method calls declared outside the file.
arXiv Detail & Related papers (2024-10-30T18:07:21Z) - Inferring Pluggable Types with Machine Learning [0.12031796234206132]
This paper investigates how to use machine learning to infer type qualifiers automatically.<n>We propose a novel representation, NaP-AST, that encodes minimal dataflow hints for the effective inference of type qualifiers.
arXiv Detail & Related papers (2024-06-21T22:32:42Z) - Understanding How CodeLLMs (Mis)Predict Types with Activation Steering [6.975009142727399]
Research shows that Large Language Models (LLMs) often lack a deep understanding of program semantics.<n>In this work, we examine the task of type prediction.<n>We show that steering successfully activates a type prediction mechanism that is shared by both Python and TypeScript.
arXiv Detail & Related papers (2024-04-02T12:44:44Z) - Generative Type Inference for Python [62.01560866916557]
This paper introduces TypeGen, a few-shot generative type inference approach that incorporates static domain knowledge from static analysis.
TypeGen creates chain-of-thought (COT) prompts by translating the type inference steps of static analysis into prompts based on the type dependency graphs (TDGs)
Experiments show that TypeGen outperforms the best baseline Type4Py by 10.0% for argument type prediction and 22.5% in return value type prediction in terms of top-1 Exact Match.
arXiv Detail & Related papers (2023-07-18T11:40:31Z) - TypeT5: Seq2seq Type Inference using Static Analysis [51.153089609654174]
We present a new type inference method that treats type prediction as a code infilling task.
Our method uses static analysis to construct dynamic contexts for each code element whose type signature is to be predicted by the model.
We also propose an iterative decoding scheme that incorporates previous type predictions in the model's input context.
arXiv Detail & Related papers (2023-03-16T23:48:00Z) - Do Machine Learning Models Produce TypeScript Types That Type Check? [2.1365083849371747]
We present TypeWeaver, a TypeScript type migration tool that can be used with an arbitrary type prediction model.
We evaluate it with three models from the literature: DeepTyper, a recurrent neural network; LambdaNet, a graph neural network; and InCoder, a general-purpose, multi-language transformer.
With the best type prediction model, we find that only 21% of packages type check, but more encouragingly, 69% of files type check successfully.
arXiv Detail & Related papers (2023-02-23T16:59:38Z) - Annotation Error Detection: Analyzing the Past and Present for a More
Coherent Future [63.99570204416711]
We reimplement 18 methods for detecting potential annotation errors and evaluate them on 9 English datasets.
We define a uniform evaluation setup including a new formalization of the annotation error detection task.
We release our datasets and implementations in an easy-to-use and open source software package.
arXiv Detail & Related papers (2022-06-05T22:31:45Z) - Annotation Curricula to Implicitly Train Non-Expert Annotators [56.67768938052715]
voluntary studies often require annotators to familiarize themselves with the task, its annotation scheme, and the data domain.
This can be overwhelming in the beginning, mentally taxing, and induce errors into the resulting annotations.
We propose annotation curricula, a novel approach to implicitly train annotators.
arXiv Detail & Related papers (2021-06-04T09:48:28Z) - LambdaNet: Probabilistic Type Inference using Graph Neural Networks [46.66093127573704]
This paper proposes a probabilistic type inference scheme for TypeScript based on a graph neural network.
Our approach can predict both standard types, like number or string, as well as user-defined types that have not been encountered during training.
arXiv Detail & Related papers (2020-04-29T17:48:40Z)
This list is automatically generated from the titles and abstracts of the papers in this site.
This site does not guarantee the quality of this site (including all information) and is not responsible for any consequences.