Add a follower, don t miss the follow-up updates~
Authorized by the author, this article is translated and summarized from the personal blog "Understanding TypeScript's Popularity" of a member of the TypeScript Team orta.
Original author: orta
Original link: orta.io/notes/js/wh...
On npm , TypeScript downloads are doubling every year. Today (blog published on April 14, 2021), it has about 20 million downloads per week. In April last year, this number was about 10 million times. It still maintains a trend of rapid growth without any signs of slowing down.
1. How did we make it so popular?
Starting from version 2.0, TypeScript regularly releases a release every two months. But now we have slowed down the pace of release and changed to release once every three months. Among them, we will spend one month writing new features and releasing the beta version, and the remaining two months for testing and bug fixes on the beta version, which makes subsequent releases more stable.
1.1 Timeline of major events
In my opinion, these are the big events that have allowed TypeScript to continue to push the limits of popularity:
2014-Rewrite TypeScript, TS v1.1-After TypeScript went live, we reviewed the TypeScript code base again and figured out what it is, so we discarded the original code and rewritten it in a functional style (different (From the original class with variable characteristics)-This architecture has been in use today, and it can run stably and efficiently for a long time in a process that rarely changes. Someone once mentioned that the predecessor of TypeScript was written in C++, and I am not sure of its authenticity.
2016-Embrace DefinitedTyped, TS v2.0-DefinitelyTyped is a side project written by volunteers. At that time there were some other systems similar to DefinitelyTyped. The TypeScript team adopted DefinitelyTyped and incorporated the concept of @types/x into their compilers. In the process of adopting and maintaining DefinitelyTyped, the TypeScript team conducted serious tests and improved the workflow, which helped it become one of the most active Repo on GitHub. The story about DT is worth reading.
2018-Added TypeScript support in Babel, Babel 7-This is the starting point for TypeScript to become the end of the code base. TypeScript increase support to TypeScript added some constraints (Translator's Note: In Babel in Isolated modules ), but it is worth it. Since then, TypeScript no longer needs the complicated migration process from eslint to tslint, but is as easy as checking a checkbox.
2018-Composite Projects, TS v3.0-There are many ways to deal with large-scale source code libraries, and TypeScript's processing method is Composite Projects. By using the .d.ts file as the boundary of the project, you can maintain many TypeScript sub-projects in a single code base. This saves time and memory, and most importantly it allows you to expand it into a very large code base.
2020-Rewriting user documentation-It is my job to rewrite the documentation, so don't trust this part of the description, but TypeScript documentation has been weak over the years. I work with many older people in the compiler team to rewrite user-oriented documents and provide them with an online editor that helps them understand TypeScript. This is the first step in answering language questions, and good documentation allows the compiler team to focus on the compiler.
1.2 Who are the competitors of TypeScript?
So, if our goal is to provide support as a tool, there are a few competitors in this field that TypeScript cannot compete with:
ESLint and TSLint: Same positioning as TypeScript. They are both used to highlight possible errors in the code, but they do not add new syntax to the inspection process. Neither is intended to run as IDE-integrated tools, and TS and TS/ESLint often say that features that are not meaningful to the project are "the domain of the other." In modern code, the existence of TS/ESLint allows TypeScript to do fewer checks, which are not applicable to all code bases. Although some functions overlap, they can be used as good supplementary tools.
So why did most of the open source Flow codebase eventually migrate to TypeScript? In my opinion, it is largely determined by the different focuses of the two teams. Flow was built to maintain Facebook's code base, and TypeScript was built as an independent language. There are two pieces of evidence to prove:
Comparing DefinitelyTyped and Flow's approach to types, the TypeScript team will take turns to have a compiler engineer to support our build tools for DefinitelyTyped and help manage the community. And Flow, it is almost completely maintained by the community. DT is now larger, because they have been working on the development of non-Facebook code, it will be difficult to obtain financial support from the Flow team.
The independent environment that Microsoft created internally for TypeScript allows it to freely focus on tool development and maintenance of the entire ecosystem, instead of just focusing on solving a particularly difficult problem. This allows the TypeScript team to work with many people and continue to release features the community wants. As time goes by, I guess that because of the slowdown in external demand growth, it becomes increasingly difficult for the Flow team to allocate time for community work. This forms a vicious circle. This makes Flow today no longer a direct "competitor" of TypeScript, but an interesting perspective on how to use different constraints to solve similar problems from different perspectives.
2. The future
2.1 What do you think about the future of TypeScript?
The idea is to create a syntax for a type system like TypeScript, but not to define what happens when JS runs.
const a: string = "1234" //will become like this const a /*: string */ = "1234" //Pass in the JS engine to copy the code
2.2 Today's competitors
2.3 How does TypeScript see its position in the ecosystem?
TypeScript hopes to innovate in the field of type systems and editor tools. We have one of the most expressive type systems in mainstream programming languages.
2.4 How does TypeScript see its audience?
The main audiences of TypeScript are:
- JS + JSDoc users (as a language tool)
- TypeScript users (as a compiler, language tool)
- TypeScript strict mode (as a compiler, language tool)
Although the project is built with tools such as babel/swc/sucrase/esbuild, tsc is optional, but the above audiences can still get new features every time or at least every two TS version releases (Translator's Note: babel , Esbuild, etc. will be updated to support new features of TS. The TS team may go directly to these projects, or they may provide features for these projects without tsc, such as through vscode. You can learn more about the release plan in the TS roadmap ).
2.5 How does TypeScript track the JS ecology?
The team listens to feedback in the following ways:
- GitHub issues has a constant stream of comments
- Microsoft internal team asked for features or asked us to help debug their slow code base
- Connect with the community through Gitter or Discord in the TypeScript community
- User testing of ideas/designs through Microsoft's internal tools
- It has a very close relationship with VS Code, and feedback from many language tools comes from them
- We will read every tweet of the @TypeScript team
- We will track blog posts about migrating to TypeScript and migrating from TypeScript
- We will track industry surveys and programming language overviews
 orta: twitter.com/orta
 Original: orta.io/notes/js/wh...
 npm: www.npmjs.com/
 DT's story: blog.johnnyreilly.com/2019/10/08/
 isolated modules: www.typescriptlang.org/tsconfig#is...
 soundness: logan.tw/posts/2014/
 TS is not type complete: www.typescriptlang.org/docs/handbo...
 Large code base: flow.org/en/docs/lan...
 A lot of incredible work: medium.com/flow-type/i...
 TS roadmap: github.com/microsoft/T...