TS 类型

12/22/2025

TS 类型的实践之旅

ts 类型的实践之旅,记录下自己的学习过程。

1. 基础类型

- 数字(Number)
- 字符串(String)
- 布尔值(Boolean)
- 数组(Array)
- 元组(Tuple)
- 枚举(Enum)
- 任意值(Any)
- 空值(Void)
- 未知值(Unknown)
-  never 类型
-  类型断言(Type Assertion)
-  类型守卫(Type Guard)
-  类型别名(Type Alias)
-  接口(Interface)
-  类(Class)
-  泛型(Generic)
-  类型参数(Type Parameter)
-  类型约束(Type Constraint)
-  类型推断(Type Inference)
-  类型兼容性(Type Compatibility)
-  类型映射(Type Mapped)
-  类型条件(Type Conditional)
-  类型索引(Type Index)
-  类型映射(Type Mapped)
-  类型条件(Type Conditional)

2. 高级类型

-  交叉类型(Intersection Type)
-  联合类型(Union Type)
-  类型保护(Type Guard)
-  类型映射(Type Mapped)
-  类型条件(Type Conditional)

3. 函数类型

-  函数声明(Function Declaration)
-  函数表达式(Function Expression)
-  箭头函数(Arrow Function)
-  函数重载(Function Overloading)
-  可选参数和默认参数(Optional Parameters and Default Parameters)
-  剩余参数(Rest Parameters)
-  函数类型的类型注解(Function Type Annotations)
-  函数类型的类型推断(Function Type Inference)
-  函数类型的类型兼容性(Function Type Compatibility)