API reference / @evolu/common / Evolu/Internal / upsertable
Function: upsertable()
function upsertable<Props>(props): ValidMutationSize<NullableToOptionalProps<Props & object>>;
Defined in: packages/common/src/Evolu/Schema.ts:381
Type Factory to create upsertable Type. It makes nullable Types optional, includes optional default columns (createdAt, isDeleted), and ensures the maxMutationSize.
Example
const UpsertableTodo = upsertable(Schema.todo);
type UpsertableTodo = typeof UpsertableTodo.Type;
const todo = UpsertableTodo.from({
id,
title,
createdAt: "2023-01-01T00:00:00.000Z",
});
if (!todo.ok) return; // handle errors
Type Parameters
Type Parameter |
---|
Props extends Record <string , AnyType > |
Parameters
Parameter | Type |
---|---|
props | Props |
Returns
ValidMutationSize
<NullableToOptionalProps
<Props
& object
>>