Inference and Evolution of TypeScript Declaration Files

TypeScript is a typed extension of JavaScript that has become widely used. More than 2000 JavaScript libraries now have publicly available TypeScript declaration files, which allows the libraries to be used when programming TypeScript applications. Such declaration files are written manually, however, and they are often lagging behind the continuous development of the libraries, thereby hindering their usability. The existing tool tscheck is capable of detecting mismatches between the libraries and their declaration files, but it is less suitable when creating and evolving declaration files. In this work we present the tools tsinfer and tsevolve that are designed to assist the construction of new TypeScript declaration files and support the co-evolution of the declaration files as the underlying JavaScript libraries evolve. Our experimental results involving major libraries demonstrate that tsinfer and tsevolve are superior to tscheck regarding these tasks and that the tools are sufficiently fast and precise for practical use.

[1]  Frank Tip,et al.  Correlation Tracking for Points-To Analysis of JavaScript , 2012, ECOOP.

[2]  Genevieve Bell,et al.  Opening keynote , 2006, Australasian Computer-Human Interaction Conference.

[3]  Peter Thiemann,et al.  Type Analysis for JavaScript , 2009, SAS.

[4]  Martín Abadi,et al.  Understanding TypeScript , 2014, ECOOP.

[5]  Joe Gibbs Politz,et al.  TeJaS: retrofitting type systems for JavaScript , 2013, DLS '13.

[6]  Ranjit Jhala,et al.  Refinement types for TypeScript , 2016, PLDI.

[7]  François Pottier,et al.  A framework for type inference with subtyping , 1998, ICFP '98.

[8]  Jean-Baptiste Jeannin,et al.  Type inference for static compilation of JavaScript , 2016, OOPSLA.

[9]  Julia L. Lawall,et al.  Documenting and automating collateral evolutions in linux device drivers , 2008, Eurosys '08.

[10]  Lars Ole Andersen,et al.  Program Analysis and Specialization for the C Programming Language , 2005 .

[11]  Esben Andreasen,et al.  Determinacy in static analysis for jQuery , 2014, OOPSLA 2014.

[12]  Jim Baker,et al.  Design and evaluation of gradual typing for python , 2015, DLS.

[13]  Sam Tobin-Hochstadt,et al.  The design and implementation of typed scheme , 2008, POPL '08.

[14]  Gavin M. Bierman,et al.  Safe & Efficient Gradual Typing for TypeScript , 2015, POPL.

[15]  Bjarne Steensgaard,et al.  Points-to analysis in almost linear time , 1996, POPL '96.

[16]  Sam Tobin-Hochstadt,et al.  Practical Optional Types for Clojure , 2016, ESOP.

[17]  Sukyoung Ryu,et al.  SAFEWAPI: web API misuse detector for web applications , 2014, SIGSOFT FSE.

[18]  Avik Chaudhuri,et al.  The ins and outs of gradual type inference , 2012, POPL '12.

[19]  Anders Møller,et al.  Checking correctness of TypeScript interfaces for JavaScript libraries , 2014, OOPSLA.

[20]  Jim Baker,et al.  Design and evaluation of gradual typing for python , 2014, DLS.