- Mastering Angular Components
- Gion Kunz
- 338字
- 2021-07-23 17:23:40
History with TypeScript in Angular
When the Angular project was developed, it was important for the core team to include the best language support they could get. While evaluating different languages, they have actually considered Google Dart and TypeScript as potential candidates to implement the framework. However, there was one major feature missing in the superset which TypeScript provided. Let's look again at our first Angular component, which we wrote in a previous section:
@Component({
selector: 'hello-world',
template: '<div>Hello World</div>'
})
class HelloWorld {}
An Angular component always consists of an EMCAScript 6 class as well as the @Component decorator which is used to configure our component. At the time when Google started developing the Angular project, there was no such thing as the ECMAScript 7 decorator proposal and TypeScript did not support something similar. Still, the Angular team didn't want to miss out on such a great language feature which can simplify and ease the use of their framework API. This marked the birth of AtScript. AtScript was created by the Angular core team as a fork of TypeScript which added the possibility to write meta annotations using an at symbol. At the same time, the ECMAScript 7 decorator proposal was created to propose a similar feature to the JavaScript standard. It was only a few months later with TypeScript's Version 1.5 that Microsoft announced that they would include experimental support for decorators in the TypeScript transpiler.
Today, Angular has switched completely to TypeScript and AtScript as well as Dart, which is no longer supported in the core project. They have changed their code to run with the experimental decorator support of TypeScript and no longer rely on a custom solution.
From this rather long-winded history, you can get that the Angular core team has fought hard to be able to use a decorator language feature. And they have succeeded. Given the importance of this feature, we'll talk a bit about the possibilities we have with ECMAScript 7 decorators within the next section.
- 物聯(lián)網(wǎng)標(biāo)準(zhǔn)化指南
- 物聯(lián)網(wǎng)智慧安監(jiān)技術(shù)
- GPS/GNSS原理與應(yīng)用(第3版)
- Hands-On Chatbots and Conversational UI Development
- 萬(wàn)物互聯(lián):蜂窩物聯(lián)網(wǎng)組網(wǎng)技術(shù)詳解
- 網(wǎng)絡(luò)安全技術(shù)與解決方案(修訂版)
- 互聯(lián)網(wǎng)安全的40個(gè)智慧洞見:2014年中國(guó)互聯(lián)網(wǎng)安全大會(huì)文集
- 中小型局域網(wǎng)組建、管理與維護(hù)實(shí)戰(zhàn)
- 世界互聯(lián)網(wǎng)發(fā)展報(bào)告·2019
- 基于性能的保障理論與方法
- Working with Legacy Systems
- 物聯(lián)網(wǎng)與智能家居
- Scala Design Patterns.
- Implementing NetScaler VPX?
- 網(wǎng)絡(luò)空間全球治理觀察