Checking Correctness of TypeScript Interfaces for JavaScript Libraries

Research output: Contribution to book/anthology/report/proceedingArticle in proceedingsResearchpeer-review

The TypeScript programming language adds optional types to JavaScript, with support for interaction with existing JavaScript libraries via interface declarations. Such declarations have been written for hundreds of libraries, but they can be difficult to write and often contain errors, which may affect the type checking and misguide code completion for the application code in IDEs.

We present a pragmatic approach to check correctness of TypeScript declaration files with respect to JavaScript library implementations. The key idea in our algorithm is that many declaration errors can be detected by an analysis of the library initialization state combined with a light-weight static analysis of the library function code.

Our experimental results demonstrate the effectiveness of the approach: it has found 142 errors in the declaration files of 10 libraries, with an analysis time of a few minutes per library and with a low number of false positives. Our analysis of how programmers use library interface declarations furthermore reveals some practical limitations of the TypeScript type system.
Original languageEnglish
Title of host publicationOOPSLA '14 Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications
Number of pages16
PublisherAssociation for Computing Machinery
Publication year2014
ISBN (print)78-1-4503-2585-1/
DOIs
Publication statusPublished - 2014
EventACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA) - Portland, United States
Duration: 20 Oct 201425 Oct 2014

Conference

ConferenceACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA)
LandUnited States
ByPortland
Periode20/10/201425/10/2014

Bibliographical note

ACM SIGPLAN OOPSLA 2014 Artifact Award

See relations at Aarhus University Citationformats

ID: 82501264