当前位置:网站首页>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 语言服务
边栏推荐
- Shell script quick start to actual combat -02
- Quick Start Tutorial for flyway
- The whole network is on the verge of triggering, and the all-round assistant for content distribution from media people - Rongmeibao
- LevelSequence source code analysis
- Architecture Battalion Module 8 Homework
- Write a database document management tool based on WPF repeating the wheel (1)
- 【论文精读】iNeRF
- Unity - by casting and cloning method dynamic control under various UGUI create and display
- Audio alignment using cross-correlation
- useragent online lookup
猜你喜欢

VOT2021 game introduction

【论文精读】iNeRF

Realize serial port receiving data based on STM32 ring queue

Payment module implementation

Basic configuration of OSPFv3

Short-circuit characteristics and protection of SiC MOSFETs

Architecture Battalion Module 8 Homework

PCB叠层设计

iNeuOS industrial Internet operating system, equipment operation and maintenance business and "low-code" form development tools

The latest masterpiece!Alibaba just released the interview reference guide (Taishan version), I just brushed it for 29 days
随机推荐
Commonly used security penetration testing tools (penetration testing tools)
「SDOI2016」征途 题解
ReentrantLock原理(未完待续)
Go1.18 upgrade function - Fuzz test from scratch in Go language
Memblaze发布首款基于长存颗粒的企业级SSD,背后有何新价值?
hboot and recovery, boot.img, system.img
C程序设计-方法与实践(清华大学出版社)习题解析
Basic Grammar Introduction of Carbon Tutorial (Tutorial)
Golang - from entry to abandonment
VOT2021比赛简介
sqlite3简单操作
Pytest初体验
Pytest first experience
How to identify fake reptiles?
HTC using official firmware as bottom bag made ROM brush card bag tutorial
Unity - by casting and cloning method dynamic control under various UGUI create and display
uniapp小程序检查、提示更新
Implementing a Simple Framework for Managing Object Information Using Reflection
Linux environment redis cluster to build "recommended collection"
嵌入式开发没有激情了,正常吗?