当前位置:网站首页>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 语言服务
边栏推荐
- Redis综述篇:与面试官彻夜长谈Redis缓存、持久化、淘汰机制、哨兵、集群底层原理!...
- The old music player WinAmp released version 5.9 RC1: migrated to VS 2019, completely rebuilt, compatible with Win11
- SiC MOSFET的短路特性及保护
- HTC using official firmware as bottom bag made ROM brush card bag tutorial
- [QNX Hypervisor 2.2用户手册]9.14 set
- PCB叠层设计
- Douyin fetches video list based on keywords API
- 财务盈利、偿债能力指标
- 支付模块实现
- MATLAB program design and application 2.4 Common internal functions of MATLAB
猜你喜欢
Realization of character makeup
全网一触即发,自媒体人的内容分发全能助手——融媒宝
利用反射实现一个管理对象信息的简单框架
C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
Quick Start Tutorial for flyway
一款国外开发的高质量WordPress下载站模板主题
NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
[Code Hoof Set Novice Village 600 Questions] Leading to the combination of formulas and programs
登录业务实现(单点登录+微信扫码+短信服务)
Bionic caterpillar robot source code
随机推荐
MATLAB program design and application 2.4 Common internal functions of MATLAB
AI automatic code writing plugin Copilot (co-pilot)
Pytorch lstm time series prediction problem stepping on the pit "recommended collection"
Chapter VII
A few permanent free network transmission, convenient and simple (Intranet through tutorials)
Several methods of mysql backup table
NVIDIA has begun testing graphics products with AD106 and AD107 GPU cores
Transfer Learning - Domain Adaptation
spark reports an error OutOfMemory "recommended collection"
BOW/DOM (top)
Arduino框架下STM32全系列开发固件安装指南
A solution to the server encountered an internal error that prevented it from fulfilling this request [easy to understand]
linux view redis version command (linux view mysql version number)
grep command written test questions
基于RT1052 Aworks nanopb string 类型固定长度使用方式(二十七)
[Code Hoof Set Novice Village 600 Questions] Merge two numbers without passing a character array
Student management system on the first day: complete login PyQt5 + MySQL5.8 exit the operation logic
Returns a zero-length array or empty collection, do not return null
Niuke.com brush questions (1)
【核心概念】图像分类和目标检测中的正负样本划分以及架构理解