当前位置:网站首页>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 语言服务
边栏推荐
- focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
- Quick Start Tutorial for flyway
- Implementing a Simple Framework for Managing Object Information Using Reflection
- [QNX Hypervisor 2.2用户手册]9.14 set
- Collation of knowledge points in Ningbo University NBU IT project management final exam
- 数据分析(一)——matplotlib
- Golang must know the Go Mod command
- find prime numbers up to n
- 「APIO2010」巡逻 题解
- 【Yugong Series】July 2022 Go Teaching Course 025-Recursive Function
猜你喜欢
TestCafeSummary
Collation of knowledge points in Ningbo University NBU IT project management final exam
PCB stackup design
Pytest初体验
Count characters in UTF-8 string function
In Golang go-redis cluster mode, new connections are constantly created, and the problem of decreased efficiency is solved
【公开课预告】:超分辨率技术在视频画质增强领域的研究与应用
A high-quality WordPress download site template theme developed abroad
Flex layout in detail
Arduino框架下STM32全系列开发固件安装指南
随机推荐
"SDOI2016" Journey Problem Solution
高通cDSP简单编程例子(实现查询高通cDSP使用率、签名),RK3588 npu使用率查询
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#
Learn about C# anonymous methods
Chapter VII
20. Support vector machine - knowledge of mathematical principles
[Open class preview]: Research and application of super-resolution technology in the field of video image quality enhancement
uniapp小程序检查、提示更新
Redis Overview: Talk to the interviewer all night long about Redis caching, persistence, elimination mechanism, sentinel, and the underlying principles of clusters!...
ReentrantLock原理(未完待续)
Chapter Six
Unity - LineRenderer show a line
MATLAB program design and application 2.4 Common internal functions of MATLAB
Embedded development has no passion, is it normal?
基于STM32 环形队列来实现串口接收数据
Document management and tools in the development process
高效并发:Synchornized的锁优化详解
关注!海泰方圆加入《个人信息保护自律公约》
信息学奥赛一本通 1941:【07NOIP普及组】Hanoi双塔问题 | 洛谷 P1096 [NOIP2007 普及组] Hanoi 双塔问题
Quick Start Tutorial for flyway