当前位置:网站首页>TypeScript 的组件
TypeScript 的组件
2022-07-31 22:11:00 【华为云】
TypeScript 语言在内部分为三个主要层。这些层中的每一层都分为子层或组件。在下图中,我们可以看到三层及其内部组件。这些层是:
Language
TypeScript 编译器
TypeScript 语言服务

1. Language
它具有 TypeScript 语言元素。它包含语法、关键字和类型注释等元素。
2. TypeScript 编译器
TypeScript 编译器 (TSC) 将 TypeScript 程序转换为其 JavaScript 代码。它还执行我们的 TypeScript 代码到 JavaScript 代码的解析和类型检查。

浏览器不支持直接执行 TypeScript 代码。所以用 TypeScript 编写的程序必须用 JavaScript 等效代码重写,它支持直接在浏览器中执行代码。为此,TypeScript 附带了名为“tsc”的 TypeScript 编译器。当前版本的 TypeScript 编译器默认支持 ES6。它编译任何模块中的源代码,如 ES6、SystemJS、AMD 等。
我们可以通过本地、全局或同时使用任何npm包安装 TypeScript 编译器。安装完成后,我们可以通过在命令行上运行“tsc”命令来编译 TypeScript 文件。
##起步安装 npm install typescript -g例子:
tsc helloworld.ts // 它将 TS 文件 helloworld 编译成 helloworld.js 文件。 编译器配置
TypeScript 编译器配置在tsconfig.json文件中给出,如下所示:
{ "compilerOptions": { "declaration": true, "emitDecoratorMetadata": false, "experimentalDecorators": false, "module": "none", "moduleResolution": "node", "noFallthroughCasesInSwitch": false, "noImplicitAny": false, "noImplicitReturns": false, "removeComments": false, "sourceMap": false, "strictNullChecks": false, "target": "es3" }, "compileOnSave": true } 3. TypeScript 语言服务
边栏推荐
- cas and spin locks (is lightweight locks spin locks)
- C程序设计-方法与实践(清华大学出版社)习题解析
- GateWay implements load balancing
- Socket回顾与I/0模型
- Thymeleaf是什么?该如何使用。
- The whole network is on the verge of triggering, and the all-round assistant for content distribution from media people - Rongmeibao
- Implementation of a sequence table
- Verilog implements a divide-by-9 with a duty cycle of 5/18
- BOW/DOM (top)
- 老牌音乐播放器 WinAmp 发布 5.9 RC1 版:迁移到 VS 2019 完全重建,兼容 Win11
猜你喜欢

Payment module implementation

【论文精读】iNeRF

Flink_CDC construction and simple use

Unity-通过预制件和克隆方法动态实现各个UGUI下控件的创建和显示

财务盈利、偿债能力指标

NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
![[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement](/img/d8/a367c26b51d9dbaf53bf4fe2a13917.png)
[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement

How to debug TestCafe

21. Support Vector Machine - Introduction to Kernel Functions

Write a database document management tool based on WPF repeating the wheel (1)
随机推荐
hboot and recovery, boot.img, system.img
C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
ThreadLocal
VOT2021 game introduction
iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools
Count characters in UTF-8 string function
How to debug TestCafe
Dry goods | 10 tips for MySQL add, delete, change query performance optimization
Go mode tidy reports an error go warning “all” matched no packages
Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios
21. Support Vector Machine - Introduction to Kernel Functions
uniapp小程序检查、提示更新
Bionic caterpillar robot source code
A high-quality WordPress download site template theme developed abroad
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
嵌入式开发没有激情了,正常吗?
Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
Go1.18 upgrade function - Fuzz test from scratch in Go language
NVIDIA已经开始测试AD106和AD107 GPU核心的显卡产品
Flex layout in detail