---
title: "defaulted"
source: "https://github.com/remix-run/remix/blob/8905f3943706e1f53696ab83e70a84873cabfc90/packages/data-schema/src/lib/schema.ts#L515"
---

# defaulted

## Summary

Provide a default when the input is `undefined`.

## Signature

```ts
function defaulted<input, output>(
  schema: Schema<input, output>,
  defaultValue: output | (() => output),
): Schema<input | undefined, output>

```

## Parameters

### `schema`

The wrapped schema

### `defaultValue`

A value or function used to produce the default

## Returns

A schema that produces the default when the input is `undefined`