[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Type](https://evolu.dev/docs/api-reference/common/Type) › optional

```ts
function optional<T>(type: T): OptionalType<T>;
```

Defined in: [packages/common/src/Type.ts:4354](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Type.ts#L4354)

Optional [Type](https://evolu.dev/docs/api-reference/common/Type/interfaces/Type).

Marks a `Type` as **optional**, meaning:

- If the value is **present**, it must match the given `Type`.
- If the value is **absent**, it is **not included** in the final object.

This is different from [undefinedOr](https://evolu.dev/docs/api-reference/common/Type/functions/undefinedOr), which allows explicit `undefined`
but **still requires the key to exist**.

### Example:

```ts
const Todo = object({
  id: TodoId,
  title: NonEmptyString1000,
  isCompleted: optional(SqliteBoolean),
});
```