当前位置:网站首页>Typescript入门教程(B站黑马程序员)
Typescript入门教程(B站黑马程序员)
2022-07-06 09:10:00 【巨人张】
视频链接:https://www.bilibili.com/video/BV14Z4y1u7pi?p=1
1. TypeScript 介绍
1.1 TypeScript 是什么
1.2 TypeScript 为什么要为 JS 添加类型支持?
1.3 TypeScript 相比 JS 的优势
2. TypeScript 初体验
2.1 安装编译 TS 的工具包
2.2 编译并运行 TS 代码
2.3 简化运行 TS 的步骤
- 注意:若
ts-node hello.ts
执行报错,需要先执行命令tsc --init
创建一个 tsconfig.json 文件,该文件是 TypeScript 项目的配置文件 - tsconfig.json 包含 TypeScript 编译的相关配置,通过更改编译配置项,我们可以让 TypeScript 编译出 ES6、ES5、node 的代码。
3. TypeScript 常用类型
3.1 类型注解
3.2 常用基础类型概述
3.3 原始类型
3.4 数组类型
3.5 类型别名
3.6 函数类型
- 如果函数没有返回值,那么,函数返回值类型为:void。
3.7 对象类型
3.8 接口
3.9 元组
3.10 类型推论
3.11 类型断言
3.12 字面量类型
3.13 枚举
3.14 any 类型
3.15 typeof
4. TypeScript 高级类型
4.1 class 类
- 类继承的两种方式:1 extends(继承父类) 2 implements(实现接口)。
- 类成员可见性:可以使用 TS 来控制 class 的方法或属性对于 class 外的代码是否可见。
- public
- protected
- private
- readonly
4.2 类型兼容性
4.3 交叉类型
4.4 泛型
Partial<Type>
Readonly<Type>
Pick<Type, Keys>
Record<Keys, Type>
4.5 索引签名类型
4.6 映射类型
5. TypeScript 类型声明文件
5.1 TS 中的两种文件类型
5.2 类型声明文件的使用说明
6. 在 React 中使用 TypeScript
6.1 使用 CRA 创建支持 TS 的项目
6.2 TS 配置文件 tsconfig.json
6.3 React 中的常用类型
边栏推荐
- MySQL real battle optimization expert 11 starts with the addition, deletion and modification of data. Review the status of buffer pool in the database
- C杂讲 浅拷贝 与 深拷贝
- MySQL ERROR 1040: Too many connections
- MySQL实战优化高手11 从数据的增删改开始讲起,回顾一下Buffer Pool在数据库里的地位
- Several errors encountered when installing opencv
- Canoe CAPL file operation directory collection
- Installation of pagoda and deployment of flask project
- Super detailed steps to implement Wechat public number H5 Message push
- vscode 常用的指令
- oracle sys_ Context() function
猜你喜欢
Can I learn PLC at the age of 33
MySQL combat optimization expert 04 uses the execution process of update statements in the InnoDB storage engine to talk about what binlog is?
CANoe下载地址以及CAN Demo 16的下载与激活,并附录所有CANoe软件版本
112 pages of mathematical knowledge sorting! Machine learning - a review of fundamentals of mathematics pptx
Why can't TN-C use 2p circuit breaker?
The programming ranking list came out in February. Is the result as you expected?
History of object recognition
Cmooc Internet + education
Canoe cannot automatically identify serial port number? Then encapsulate a DLL so that it must work
jar运行报错no main manifest attribute
随机推荐
Preliminary introduction to C miscellaneous lecture document
简单解决phpjm加密问题 免费phpjm解密工具
MySQL ERROR 1040: Too many connections
MySQL combat optimization expert 12 what does the memory data structure buffer pool look like?
AI的路线和资源
美疾控中心:美国李斯特菌疫情暴发与冰激凌产品有关
The real future of hardware engineers may not be believed by you if I say so
Not registered via @EnableConfigurationProperties, marked(@ConfigurationProperties的使用)
CAPL script printing functions write, writeex, writelineex, writetolog, writetologex, writedbglevel do you really know which one to use under what circumstances?
oracle sys_ Context() function
Use xtrabackup for MySQL database physical backup
The appearance is popular. Two JSON visualization tools are recommended for use with swagger. It's really fragrant
MySQL實戰優化高手04 借著更新語句在InnoDB存儲引擎中的執行流程,聊聊binlog是什麼?
MySQL combat optimization expert 06 production experience: how does the production environment database of Internet companies conduct performance testing?
如何搭建接口自动化测试框架?
Hugo blog graphical writing tool -- QT practice
MySQL实战优化高手07 生产经验:如何对生产环境中的数据库进行360度无死角压测?
竞赛vscode配置指南
MySQL實戰優化高手08 生產經驗:在數據庫的壓測過程中,如何360度無死角觀察機器性能?
Routes and resources of AI