[Typescript] 135. Easy - Maybe helper

import { Equal, Expect } from "../helpers/type-utils";

type Maybe<T> = T | null | undefined;

type tests = [
  Expect<Equal<Maybe<string>, string | null | undefined>>,
  Expect<Equal<Maybe<number>, number | null | undefined>>,
  Expect<Equal<Maybe<boolean>, boolean | null | undefined>>,
  Expect<Equal<Maybe<null>, null | undefined>>
];

 

posted @ 2022-12-11 22:03  Zhentiw  阅读(10)  评论(0编辑  收藏  举报