当前位置:网站首页>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 语言服务
边栏推荐
- 二叉树非递归遍历
- What's wrong with the sql syntax in my sql
- Redis综述篇:与面试官彻夜长谈Redis缓存、持久化、淘汰机制、哨兵、集群底层原理!...
- "APIO2010" Patrol Problem Solution
- focus on!Haitai Fangyuan joins the "Personal Information Protection Self-discipline Convention"
- Go mode tidy reports an error go warning “all” matched no packages
- Structure of the actual combat battalion module eight operations
- 财务盈利、偿债能力指标
- C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
- hboot与recovery、boot.img、system.img
猜你喜欢

Socket回顾与I/0模型

Socket Review and I/0 Model

PCB stackup design

Flink_CDC construction and simple use

Arduino框架下STM32全系列开发固件安装指南

支付模块实现

ThreadLocal

Implementation of a sequence table

Go1.18 upgrade function - Fuzz test from scratch in Go language

Efficient Concurrency: A Detailed Explanation of Synchornized's Lock Optimization
随机推荐
Memblaze released the first enterprise-grade SSD based on long-lasting particles. What is the new value behind it?
Unity - by casting and cloning method dynamic control under various UGUI create and display
Several methods for deleting specified elements in Golang slices
利用反射实现一个管理对象信息的简单框架
C#中引用类型的变量做为参数在方法调用时加不加 ref 关键字的不同之处
BOW/DOM (top)
一款国外开发的高质量WordPress下载站模板主题
[NLP] What is the memory of the model!
"SDOI2016" Journey Problem Solution
grep命令 笔试题
sqlite3简单操作
UVM RAL model and built-in seq
spark reports an error OutOfMemory "recommended collection"
Architecture Battalion Module 8 Homework
Basic configuration of OSPFv3
Carbon教程之 基本语法入门大全 (教程)
关注!海泰方圆加入《个人信息保护自律公约》
SQL27 View user details of different age groups
uni-app中的renderjs使用
C程序设计-方法与实践(清华大学出版社)习题解析