API Reference / @evolu/common / Types / NullablePartial
Type Alias: NullablePartial<T, NK, NP>
type NullablePartial<T, NK, NP> = { [K in keyof NP]: NP[K] };
Defined in: packages/common/src/Types.ts:67
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.
Example
type Example = {
required: string;
optionalWithNull: string | null;
};
type Result = NullablePartial<Example>;
// Result is:
// {
// required: string;
// optionalWithNull?: string | null;
// }
Type Parameters
Type Parameter | Default type |
---|---|
T | - |
NK extends keyof T | { [K in keyof T]: null extends T[K] ? K : never } [keyof T ] |
NP | Pick <T , Exclude <keyof T , NK >> & Partial <Pick <T , NK >> |