Skip to content
🔷

TypeScript 基础

50 课

为 JavaScript 添加类型安全——接口、泛型、工具类型和高级模式。

  1. 1

    TypeScript Overview

    什么 TypeScript 是, 为什么它 添加类型到 JavaScript, and 如何它 catches 错误之前运行时.

  2. 2

    TypeScript 对比 JavaScript

    如何 TypeScript differs 从 JavaScript: 静态类型, 编译-时间检查, and tooling.

  3. 3

    基础类型 in TypeScript

    primitive 类型 in TypeScript: 字符串, 数字, 布尔值, 数组, tuple, enum, and 更多.

  4. 4

    类型 Annotations and Inference

    如何 编写 explicit 类型 annotations and 当到 rely on TypeScript's 类型 inference.

  5. 5

    接口 in TypeScript

    如何 定义对象 shapes 使用接口, extend 它们, and use 它们使用类.

  6. 6

    类型 Aliases in TypeScript

    如何 创建 named 类型 aliases for primitives, unions, 对象, and 函数 signatures.

  7. 7

    Union and Intersection 类型

    组合类型使用 unions (| B) and intersections (& B) for flexible 类型 modeling.

  8. 8

    Enums in TypeScript

    定义 named 常量设置使用 numeric and 字符串 enums, and 当到 prefer alternatives.

  9. 9

    输入函数 in TypeScript

    类型函数参数, 返回值, 可选 and REST params, and 函数 overloads.

  10. 10

    Generics in TypeScript

    编写 reusable, 类型-safe 函数 and 类型 using generic 类型参数.

  11. 11

    数组 and Tuples in TypeScript

    类型数组使用元素类型 and tuples 使用 fixed-长度, 位置-输入数组.

  12. 12

    对象类型 in TypeScript

    描述对象 shapes 使用 inline 类型, 接口, 索引 signatures, and 记录.

  13. 13

    类型 Narrowing in TypeScript

    如何 TypeScript refines union 类型内部 conditional 分支 using 类型 guards.

  14. 14

    自定义类型 Guards in TypeScript

    编写用户-定义类型 guard 函数使用 'x 是类型' predicate for 自定义 narrowing.

  15. 15

    空 and undefined in TypeScript

    Handle 空 and undefined safely 使用 strictNullChecks, union 类型, and definite assignment.

  16. 16

    可选 Chaining in TypeScript

    Safely access nested 属性使用 ?. 运算符不使用运行时错误.

  17. 17

    Nullish Coalescing in TypeScript

    Provide 默认值 使用 ?? 运算符, 哪个仅 触发 on 空 and undefined.

  18. 18

    Utility 类型 in TypeScript

    构建-in 类型 transformations: 部分, 必需, 选取, Omit, 记录, Readonly, and 更多.

  19. 19

    Mapped 类型 in TypeScript

    Transform existing 类型通过映射 over 它们的键 使用自定义 modifiers and 筛选.

  20. 20

    Conditional 类型 in TypeScript

    分支类型 at 编译时间使用 T extends U ? X : Y and infer keyword.

  21. 21

    模块 in TypeScript

    组织 code 使用 ES 模块: 导入, 导出, 默认导出, and re-导出.

  22. 22

    命名空间 in TypeScript

    组织 code 使用命名空间 (内部模块) and 理解当 到 prefer ES 模块.

  23. 23

    Declaration Files (.d.ts)

    描述 JavaScript 库使用 .d.ts declaration files and declare keyword.

  24. 24

    tsconfig.JSON 配置

    配置 TypeScript 编译器使用 tsconfig.JSON: 目标, strict, paths, and 更多.

  25. 25

    类型 Inference in TypeScript

    如何 TypeScript infers 类型 automatically and 规则 governing inference 上下文.

  26. 26

    高级 Generic 模式

    Master 高级 generics: constraints, defaults, variadic tuples, and recursive 类型.

  27. 27

    Decorators in TypeScript

    Use decorators 到 annotate and 修改类, 方法, 属性, and 参数.

  28. 28

    Mixins in TypeScript

    Compose 类 behavior 从多个源 using mixin 模式相反的 继承.

  29. 29

    Strict 模式 in TypeScript

    启用 strict 编译器 flags 到 catch 大多数 bugs: 空检查, implicit 任何, and 更多.

  30. 30

    TypeScript 最佳实践

    Production-ready TypeScript 练习: naming, 输入, 错误 handling, and 项目结构.

  31. 31

    条件类型

    全面讲解 TypeScript 中的条件类型,涵盖核心概念、实现细节和实际示例。

  32. 32

    映射类型

    全面讲解 TypeScript 中的映射类型,涵盖核心概念、实现细节和实际示例。

  33. 33

    模板字面量类型

    全面讲解 TypeScript 中的模板字面量类型,涵盖核心概念、实现细节和实际示例。

  34. 34

    类型推断深入

    全面讲解 TypeScript 中的类型推断深入,涵盖核心概念、实现细节和实际示例。

  35. 35

    类型收窄技术

    全面讲解 TypeScript 中的类型收窄技术,涵盖核心概念、实现细节和实际示例。

  36. 36

    可辨识联合类型

    全面讲解 TypeScript 中的可辨识联合类型,涵盖核心概念、实现细节和实际示例。

  37. 37

    函数重载

    全面讲解 TypeScript 中的函数重载,涵盖核心概念、实现细节和实际示例。

  38. 38

    泛型约束

    全面讲解 TypeScript 中的泛型约束,涵盖核心概念、实现细节和实际示例。

  39. 39

    内置工具类型

    全面讲解 TypeScript 中的内置工具类型,涵盖核心概念、实现细节和实际示例。

  40. 40

    自定义类型守卫

    全面讲解 TypeScript 中的自定义类型守卫,涵盖核心概念、实现细节和实际示例。

  41. 41

    声明文件

    全面讲解 TypeScript 中的声明文件,涵盖核心概念、实现细节和实际示例。

  42. 42

    模块增强

    全面讲解 TypeScript 中的模块增强,涵盖核心概念、实现细节和实际示例。

  43. 43

    协变与类型兼容性

    全面讲解 TypeScript 中的协变与类型兼容性,涵盖核心概念、实现细节和实际示例。

  44. 44

    协变与逆变

    全面讲解 TypeScript 中的协变与逆变,涵盖核心概念、实现细节和实际示例。

  45. 45

    递归类型

    全面讲解 TypeScript 中的递归类型,涵盖核心概念、实现细节和实际示例。

  46. 46

    品牌类型

    全面讲解 TypeScript 中的品牌类型,涵盖核心概念、实现细节和实际示例。

  47. 47

    幻影类型

    全面讲解 TypeScript 中的幻影类型,涵盖核心概念、实现细节和实际示例。

  48. 48

    类型级编程

    全面讲解 TypeScript 中的类型级编程,涵盖核心概念、实现细节和实际示例。

  49. 49

    严格模式选项

    全面讲解 TypeScript 中的严格模式选项,涵盖核心概念、实现细节和实际示例。

  50. 50

    TypeScript 编译器 API

    全面讲解 TypeScript 中的 TypeScript 编译器 API,涵盖核心概念、实现细节和实际示例。

已完成: 0 / 500%

学习阶段

预计总时长: 14h 25m
  1. 1

    基础

    13 课 · 2h 10m

    掌握基本概念与语法,建立扎实基础。

    0/13
  2. 核心

    13 课 · 3h 15m

    深入理解核心模式与常见用例。

    0/13
  3. 进阶

    12 课 · 4h

    攻克进阶主题,开始流畅组合所学概念。

    0/12
  4. 高级

    12 课 · 5h

    掌握高级技巧并应用于真实问题。

    0/12

完成标准

完成 80% 课程、60% 练习和 50% 项目即可掌握该主题。

总体0%
  • 课程0 / 200%
  • 练习0 / 1000%
  • 项目0 / 100%

技能评估

0 / 20 已掌握
0 已掌握0 进行中20 未开始
  • 基础类型基础
    0 / 5 课 · 0%
  • 接口与类型别名核心
    0 / 5 课 · 0%
  • 泛型进阶
    0 / 3 课 · 0%
  • 类型收窄与守卫核心
    0 / 6 课 · 0%
  • 工具类型进阶
    0 / 3 课 · 0%
  • 高级类型高级
    0 / 4 课 · 0%
  • TypeScript 配置核心
    0 / 5 课 · 0%
  • TypeScript 模式高级
    0 / 5 课 · 0%

+12 更多技能

推荐下一步: typescript-overview
20 剩余

动手做项目

通过引导式项目应用所学,含起始代码与解决方案。

查看项目

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误