> For the complete documentation index, see [llms.txt](/llms.txt).
> The full corpus is at [llms-full.txt](/llms-full.txt).

# defineSchema

> **defineSchema**\<`TSchemaDefinition`\>(`definition`): `TSchemaDefinition`

Defined in: packages/schema/dist/index.d.ts:189

A helper wrapper that adds editor support, such as autocomplete and type checking, for a schema definition.

## Type Parameters

### TSchemaDefinition

`TSchemaDefinition` *extends* [`SchemaDefinition`](/api/editor/type-aliases/schemadefinition/)

## Parameters

### definition

`TSchemaDefinition`

## Returns

`TSchemaDefinition`

## Example

```ts
import { defineSchema } from '@portabletext/editor'

const schemaDefinition = defineSchema({
 decorators: [{name: 'strong'}, {name: 'em'}, {name: 'underline'}],
 annotations: [{name: 'link'}],
 styles: [
   {name: 'normal'},
   {name: 'h1'},
   {name: 'h2'},
   {name: 'h3'},
   {name: 'blockquote'},
 ],
 lists: [],
 inlineObjects: [],
 blockObjects: [],
}
```