Abstract:
Javascript has become the most widespread programming language used to build
software for many platforms, including web, mobile, backends, hardware, and desktop
applications. It is a dynamically typed programming language that gives freedom to
ignore types and build applications quickly. Still, Javascript is a poor language for
identifying bugs at the compile time and maintaining large applications because of the
dynamic behavior. The developers can use Typescript to add type syntaxes on top of
JavaScript as a solution.
However, not enough empirical studies exhibit how Typescript impacts detecting
detects in applications. We decided to follow an empirically quantified "what-if" style
of experimentation. We collected merged javascript bug-fix pull requests from selected
open-source projects. Then we selected candidate bugs by applying our predefined
criteria such as discarded pull requests with more than five files, code-refactoring, and
configuration changes. We manually added Typescript annotation to the buggy code
base and checked whether Typescript could detect the defects at the compile type. We
assessed 500 bug-fix pull requests over five projects and identified that using
Typescript over Javascript could have prevented 22.7% of bugs.
According to our literature review, this is one of the few studies related to Typescript
identifying bug impact. We believe this study will be significant evidence to consider
using Typescript over Javascript in the future to reduce the significant number of bugs.
This result will influence developers to adapt to the Typescript from Javascript.
However, Typescript is not a silver build for Javascript because developers have to add
extra code and complexity to the codebase. So, More research on Typescript is needed.
In the future, we plan to explore the cognitive complexity of applying Typescript and
the number of required lines to annotate. Furthermore, we plan to use a Typescript
converter for annotating to increase the number of sample bugs to analyze.
Citation:
Madurajith, G.M.D. (2022). Analyzing the impact on identifiable defects in a code independent of typescript [Master's theses, University of Moratuwa]. Institutional Repository University of Moratuwa. http://dl.lib.uom.lk/handle/123/21903