zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[Typescript] 108. Easy - Nullable

typescript Easy 108
2023-09-14 09:00:44 时间

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 t = Nullable<{a: number, b: string}>