API reference@evolu/commonTypes › NullablePartial

type NullablePartial<T, NK, NP> = { [K in keyof NP]: NP[K] };

Defined in: packages/common/src/Types.ts:279

Makes properties optional if they accept null as a value.

For each property in T, if null is a valid value for that property, the property will be made optional in the resulting type.

Optional nullable properties

import { assertType, type NullablePartial } from "@evolu/common";

type Example = {
  required: string;
  optionalWithNull: string | null;
};

assertType<
  {
    required: string;
    optionalWithNull?: string | null;
  },
  NullablePartial<Example>
>();