摘要: Typescript has NonNullable<T>, let's build a Nullable<T> type Nullable<T extends Record<PropertyKey, unknown>> = { [K in keyof T]: T[K] | null } type 阅读全文
posted @ 2022-11-17 15:16 Zhentiw 阅读(42) 评论(0) 推荐(0) 编辑
摘要: You can use `extends infer X` to assign the result of an expression to a variable type SomeFunction<U> = SuperHeavyComputation<U> extends infer Result 阅读全文
posted @ 2022-11-17 15:11 Zhentiw 阅读(8) 评论(0) 推荐(0) 编辑