export type Nullable < T > = T | null ; export function toNullable < T > ( data ? ) { return typeof data === "undefined" ? null : data ; } export function toNullableDate ( data ? ) { return typeof data === "undefined" ? null : new Date ( data . $date ) ; }