Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
TypeScript Design Goals
Clone this wiki locally
This document serves to outline the general design principles we have based the TypeScript language on. While it is by no means exhaustive, it aims to summarize the rules by which we've made many of the decisions that have shaped the language. Some of these rules are subjective, and at times are at odds with each other; reaching the right balance and making the right exceptions is the essence of how successful programming languages are designed.
We recommend reading Chapter 1 of the TypeScript Language Specification for more background on the overall aims of the TypeScript language itself, and how it intends those goals to be achieved.
- Statically identify constructs that are likely to be errors.
- Provide a structuring mechanism for larger pieces of code.
- Impose no runtime overhead on emitted programs.
- Produce a language that is composable and easy to reason about.
- Align with current and future ECMAScript proposals.
- Avoid adding expression-level syntax.
- Use a consistent, fully erasable, structural type system.
- Be a cross-platform development tool.
- Do not cause substantial breaking changes from TypeScript 1.0.
- Apply a sound or "provably correct" type system. Instead, strike a balance between correctness and productivity.
- Provide an end-to-end build pipeline. Instead, make the system extensible so that external tools can use the compiler for more complex build workflows.
- Add or rely on run-time type information in programs, or emit different code based on the results of the type system. Instead, encourage programming patterns that do not require run-time metadata.
- Provide additional runtime functionality or libraries. Instead, use TypeScript to describe existing libraries.
- Introduce behaviour that is likely to surprise users. Instead have due consideration for patterns adopted by other commonly-used languages.