TypeScript
TypeScript extends JavaScript with optional type annotations, which describe the kinds of values code expects. Its checker can flag likely errors before the program runs. A historical test found bugs the checker could catch, while the effect of adopting TypeScript on defect rates in ongoing projects remains uncertain. (Rastogi et al., 2015; Microsoft TypeScript Team, n.d.d; Gao et al., 2017b; Bogner & Merkel, 2022)
Origins and design goals
Microsoft designed TypeScript 1.0 for large JavaScript applications. It released version 0.8 in October 2012 and announced version 1.0 in April 2014. The 2012 unveiling advertised static typing for developer tools alongside class syntax and a preview of ECMAScript 6, an upcoming edition of the JavaScript standard. (Turner, 2014; Øredev, 2012)
The design goals pair early error detection with a way to organise larger programs. They also call for preserving how JavaScript code behaves when it runs. (Microsoft TypeScript Team, n.d.d)
Type compatibility and erasure
TypeScript generally checks whether a value supplies the properties and methods that the receiving code expects. This is called structural typing. For example, code that expects an object with a text property named name can accept an object that also has an age property. Declaring those objects under different type names ordinarily leaves that compatibility intact. (Microsoft TypeScript Team, n.d.c)
Type erasure means removing type annotations from the code that runs. Erasure and checking are separate operations. Node.js illustrates the distinction because it can execute TypeScript files whose extra syntax can all be erased. In that mode, it strips the TypeScript syntax and runs the resulting JavaScript without checking the types. (Node.js, n.d.c)
Limits of the checker
TypeScript deliberately allows some operations whose safety the checker cannot establish in advance. This choice is called unsoundness. Passing the checker can therefore leave some type errors to appear during execution. The language team framed the choice as a balance between correctness and developer productivity. (Microsoft TypeScript Team, n.d.c; Microsoft TypeScript Team, n.d.d)
Checking external data and imports
A type assertion, such as value as User, tells the checker to treat the value as a particular type. The assertion disappears during compilation and performs no runtime validation. A JSON value with a missing field can still reach code that expects it. (Microsoft TypeScript Team, n.d.a)
An import can pass type checking and still fail when the program starts. For example, TypeScript’s paths setting can tell the checker where to find a module while leaving the import name in the generated JavaScript intact. (Microsoft TypeScript Team, n.d.b)
Runtime checks in Safe TypeScript Weak evidence: few or small studies support this
A research prototype called Safe TypeScript caught type errors by adding checks during execution. Running those checks while building the prototype’s own compiler took 15% longer than building it with the checks disabled. Preliminary work on a later compiler version found higher costs for checking structural types. (Rastogi et al., 2015)
Bugs the checker can flag Weak evidence: few or small studies support this
Type checking could have flagged a minority of past JavaScript bugs; Type systems covers this kind of evidence across languages. TypeScript 2.0 and Flow 0.30, another JavaScript type checker, each flagged about 15% of 400 public bugs. Researchers added the annotations by hand, guided by the eventual fixes (Gao et al., 2017b).
The result depended on the checker version. TypeScript 2.0 could flag 22 bugs in the sample that version 1.8 could not (Gao et al., 2017b).
TypeScript changes by coding agents
Type errors during editing Weak evidence: few or small studies support this
The type errors an AI coding agent sees can depend on how it edits files. In a repository experiment, Claude Code saw type errors during 23 of 39 TypeScript runs when forced to use the edit tool its plugin monitored. Across the configurations with the plugin, nine runs failed without receiving type diagnostics. (Nazarova, 2026)
Correct syntax alone would have removed relatively few compilation failures in two benchmarks of generated TypeScript functions. Ideal syntax enforcement could have reduced the number of failures by at most 9.0% on HumanEval and 4.8% on MBPP. (Mündler et al., 2025)
Explicit any and type assertions Weak evidence: few or small studies support this
Agents added more explicit any annotations than people did in one comparison of pull requests selected for type-related changes. The any type lets code use a value without the usual checks on its type. Agents added an average of 2.16 explicit any annotations per pull request in that sample, compared with 0.24 for people. (Lee et al., 2026c; typescript-eslint, n.d.a)
The same sample showed more type assertions and more non-null assertions in agent changes. A non-null assertion tells the checker to assume a value is neither null nor undefined. The study counted these forms by matching patterns in source text. (Lee et al., 2026c)
Explicit any can be absent from agent changes. In a comparison on one feature with fixed strict settings, both the human and agent versions used zero explicit any annotations in application code. (Integrity Constraint, n.d.)
A lint rule can flag a deliberately written any annotation. The rule catches explicit any annotations that the compiler’s noImplicitAny option does not reject. (typescript-eslint, n.d.a)
Repairs to asynchronous code Weak evidence: few or small studies support this
Coding agents can clear a lint warning about an ignored promise while leaving the bug in place. A promise represents the eventual result or failure of an operation. In a lint vendor’s experiment on two existing bugs, all 16 runs by Claude Code and Codex cleared the warning, and three passed the behaviour check. (Bleasel, n.d.)
Twelve of the repairs used void to mark the promise as intentionally ignored, which leaves its failure unhandled. The experiment asked agents to preserve runtime behavior, a constraint Claude Code cited when leaving the bug in place. (Bleasel, n.d.; typescript-eslint, n.d.b)
Code quality and defects in projects
Comparisons of existing repositories found fewer signs of hard-to-maintain code in TypeScript projects. Among 604 open-source front-end web applications, TypeScript projects had fewer code smells, patterns that indicate a potential maintenance problem, per line. An independent thesis comparing ten projects per language likewise found more code smells in the JavaScript projects (Bogner & Merkel, 2022; Ferreira, 2023).
The same 604-project comparison leaves the effect on defects unresolved. TypeScript projects averaged 20.6% of commits classified as bug fixes, against 12.6% for JavaScript, but the classification relied on words in commit messages and team differences could affect it (Bogner & Merkel, 2022). The wider dispute over static typing and defects is covered in Type systems.
Kinds of reported faults Weak evidence: few or small studies support this
Tooling and configuration problems made up the largest category in a study of 633 bug reports from 16 TypeScript projects. An older JavaScript study classified bugs partly by whether they involved a webpage’s document structure. The two studies’ categories overlap only in part, which limits what their percentages can say about the effect of typing. (Tang et al., 2026a; Ocariza et al., 2017)
How developers read type information Weak evidence: few or small studies support this
The presence of type annotations or declarations did not draw more direct looks to those lines in a small eye-tracking experiment. The 26 undergraduate participants summarised TypeScript code and looked for the locations of bugs. The study measured where participants looked, leaving open whether type information makes professional developers faster or more accurate. (Flint et al., 2026)
Use in practice
TypeScript use shows up both in survey responses and in repository activity. Among the 14,099 people who answered the 2026 Stack Overflow language question, 43.8% reported extensive development work with TypeScript in the preceding year. Respondents could select multiple languages, and 62% reported JavaScript. On GitHub, TypeScript ranked first in August 2025 by monthly contributors, with about 2.64 million. (Stack Overflow, 2026; GitHub Staff, 2025)
Further reading
- Microsoft TypeScript Team (n.d.c). The TypeScript Handbook explains how the checker decides whether one type can stand in for another.
- Rastogi et al. (2015). A prototype study that measures the cost of adding runtime checks.
- Gao et al. (2017b). A test of whether type checkers could have flagged past JavaScript bugs.
- Bogner and Merkel (2022). A comparison of code quality and maintenance activity in existing JavaScript and TypeScript projects.
- Lee et al. (2026c). A comparison of how coding agents and people use TypeScript’s type features in pull requests.
First published ; last updated .
Known gaps
What this article cannot tell you yet.
- The historical estimate of detectable bugs lacks an independent replication using the same method.
- The effect of adopting TypeScript on project defect rates has no controlled estimate here.
- The effect on workplace productivity remains open.
- How often type checks and behaviour tests flag the same defects in final TypeScript patches from coding agents remains unclear.
- The frequency of agent-introduced errors in runtime validation, module loading and asynchronous code remains unclear.
- The frequency with which type assertions in agent changes lead to runtime failures remains unclear.
References
- Solid source
- Rated highly trustworthy by the research, and every passage taken from it was found in it.
- Weak source
- Rated low, or a passage taken from it was not found in it.
- Medium trust
- Rated medium by the research.
- Not checked
- Rated high, but its passages could not all be checked against it.
Show all 23 references
- Bleasel, H. (n.d.). What happens to a promise nobody awaits. Ultracite Research. https://www.ultracite.ai/research/floating-promises Medium trust Vendor page, read in large part.
- Bogner, J., & Merkel, M. (2022). To type or not to type? A systematic comparison of the software quality of JavaScript and TypeScript applications on GitHub. Proceedings of the 19th International Conference on Mining Software Repositories. https://arxiv.org/abs/2203.11115 Solid source Peer-reviewed, read in large part.
- Ferreira, P. A. d. C. (2023). Investigando o impacto dos code smells na manutenibilidade de aplicações JavaScript e TypeScript. Universidade Federal do Ceará. https://repositorio.ufc.br/bitstream/riufc/74644/1/2023_tcc_padecferreira.pdf Medium trust Read in large part.
- Flint, S. W., Dyer, R., & Sharif, B. (2026). Do developers read type information? An eye-tracking study on TypeScript. ACM/IEEE 34th International Conference on Program Comprehension. https://arxiv.org/html/2602.04824v1 Medium trust Preprint, read in large part.
- Gao, Z., Bird, C., & Barr, E. T. (2017b). To type or not to type: Quantifying detectable bugs in JavaScript. Proceedings of the 39th International Conference on Software Engineering. https://swizec.com/pdfs/typestudy.pdf Solid source Peer-reviewed, read in large part.
- GitHub Staff (2025). Octoverse: A new developer joins GitHub every second as AI leads TypeScript to #1. The GitHub Blog. https://github.blog/news-insights/octoverse/octoverse-a-new-developer-joins-github-every-second-as-ai-leads-typescript-to-1/ Weak source Vendor page, read in large part.
- Integrity Constraint (n.d.). AI agent case study: Team management page. Integrity Constraint. https://integrity-constraint.net/ai-experiment Medium trust Blog post, read in large part.
- Lee, I., Ul Hassan, T., & Hindle, A. (2026c). Mining type constructs using patterns in AI-generated code. Proceedings of the 23rd International Conference on Mining Software Repositories. https://arxiv.org/html/2602.17955v1 Solid source Peer-reviewed, read in large part.
- Mündler, N., He, J., Wang, H., Sen, K., Song, D., & Vechev, M. (2025). Type-constrained code generation with language models. Proceedings of the ACM on Programming Languages. https://arxiv.org/pdf/2504.09246 Solid source Peer-reviewed, read in large part.
- Nazarova, I. (2026). Type errors cost our coding agents under 1% of their time. Evil Martians. https://evilmartians.com/chronicles/type-errors-cost-our-coding-agents-under-one-percent-of-their-time Medium trust Blog post, read in large part.
- Node.js (n.d.c). Modules: TypeScript. Node.js Documentation. https://nodejs.org/dist/latest/docs/api/typescript.html Solid source Documentation, read in large part.
- Ocariza, F. S., Bajaj, K., Pattabiraman, K., & Mesbah, A. (2017). A study of causes and consequences of client-side JavaScript bugs. IEEE Transactions on Software Engineering. https://people.ece.ubc.ca/frolino/docs/jsbugsstudy_journal.pdf Solid source Peer-reviewed, read in large part.
- Øredev (2012). TypeScript: JavaScript development at application scale. Øredev 2012. https://archive.oredev.org/oredev2012/prod/oredev/2012.nsf/blogposts/662de0f529407a69c1257a8b0040d0d8 Medium trust Read in large part.
- Rastogi, A., Swamy, N., Fournet, C., Bierman, G. M., & Vekris, P. (2015). Safe & efficient gradual typing for TypeScript. Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. https://goto.ucsd.edu/~pvekris/docs/safets.pdf Solid source Peer-reviewed, read in large part.
- Stack Overflow (2026). Programming, scripting, and markup languages. Stack Overflow Developer Survey. https://survey.stackoverflow.co/2026/technology/data/languages Medium trust Read in large part.
- Tang, T., Alimadadi, S., & Sumner, N. (2026a). From logic to toolchains: An empirical study of bugs in the TypeScript ecosystem. 23rd International Conference on Mining Software Repositories. https://arxiv.org/html/2601.21186v1 Solid source Preprint, read in large part.
- Turner, J. (2014). Announcing TypeScript 1.0. Microsoft TypeScript Dev Blog. https://devblogs.microsoft.com/typescript/announcing-typescript-1-0/ Medium trust Vendor page, read in large part.
- typescript-eslint (n.d.a). no-explicit-any. typescript-eslint. https://typescript-eslint.io/rules/no-explicit-any/ Solid source Documentation, read in large part.
- typescript-eslint (n.d.b). no-floating-promises. typescript-eslint. https://typescript-eslint.io/rules/no-floating-promises/ Solid source Documentation, read in large part.
- Microsoft TypeScript Team (n.d.d). TypeScript design goals. GitHub. https://github.com/microsoft/TypeScript-wiki/blob/main/TypeScript-Design-Goals.md?plain=1 Solid source Documentation, read in large part.
- Microsoft TypeScript Team (n.d.c). Type compatibility. TypeScript Handbook. https://www.typescriptlang.org/docs/handbook/type-compatibility.html Solid source Documentation, read in large part.
- Microsoft TypeScript Team (n.d.b). Modules reference. TypeScript Handbook. https://www.typescriptlang.org/docs/handbook/modules/reference.html Solid source Documentation, read in large part.
- Microsoft TypeScript Team (n.d.a). Everyday types. TypeScript Handbook. https://www.typescriptlang.org/docs/handbook/2/everyday-types.html Solid source Documentation, read in large part.