当前位置:网站首页>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 语言服务
边栏推荐
- 高效并发:Synchornized的锁优化详解
- Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...
- 信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
- Socket Review and I/0 Model
- 关注!海泰方圆加入《个人信息保护自律公约》
- Several methods of mysql backup table
- The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
- Istio introduction
- JS basic exercises
- Getting Started with Tkinter
猜你喜欢

How to identify fake reptiles?

The article you worked so hard to write may not be your original

数据分析(一)——matplotlib

Bionic caterpillar robot source code
![[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

Memblaze发布首款基于长存颗粒的企业级SSD,背后有何新价值?

The difference between adding or not adding the ref keyword when a variable of reference type is used as a parameter in a method call in C#

利用反射实现一个管理对象信息的简单框架

全网一触即发,自媒体人的内容分发全能助手——融媒宝

Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...
随机推荐
二叉树非递归遍历
PCB stackup design
如何减少软件设计和实现之间鸿沟
HTC using official firmware as bottom bag made ROM brush card bag tutorial
Pytorch lstm time series prediction problem stepping on the pit "recommended collection"
高效并发:Synchornized的锁优化详解
LevelSequence source code analysis
Arduino框架下STM32全系列开发固件安装指南
Financial profitability and solvency indicators
A few permanent free network transmission, convenient and simple (Intranet through tutorials)
Chapter VII
Redis综述篇:与面试官彻夜长谈Redis缓存、持久化、淘汰机制、哨兵、集群底层原理!...
Socket回顾与I/0模型
MATLAB program design and application 2.4 Common internal functions of MATLAB
A high-quality WordPress download site template theme developed abroad
The principle of ReentrantLock (to be continued)
grep命令 笔试题
Getting Started with Tkinter
[NLP] What is the memory of the model!
Federated Learning: Multi-source Knowledge Graph Embedding in Federated Scenarios