📜  打字稿使对象的每个属性都可以为空 - 无论代码示例

📅  最后修改于: 2022-03-11 14:57:26.401000             🧑  作者: Mango

代码示例1
// 1 level depth
type Nullable = { [K in keyof T]: T[K] | null };

// deep by recurisve call
type DeepNullable = {
  [K in keyof T]: DeepNullable | null;
};