泛型编程(下)
介绍一些 TS 内置工具类型的用法及实现 Readonly & Mutable123456789101112131415161718192021type Person = { id: number; name: string; age: number };type Readonly<T> = { readonly [K in keyof T...
介绍一些 TS 内置工具类型的用法及实现 Readonly & Mutable123456789101112131415161718192021type Person = { id: number; name: string; age: number };type Readonly<T> = { readonly [K in keyof T...
泛型就像函数函数 12const f = (a, b) => a + bconst result = f(1, 2) // 3 泛型 12type F<A, B> = A | Btype Result = F<string, number> // string | number 泛型就像函数 函数的本质是什么 函数的本质是推后执行的、部分待定的代码 12...