# DocumentOf

A document in the named collection, or in any collection. The generated types give its metadata and body the types from your config.

> Every page: https://tomekit.aayush.cv/llms.txt

```ts
type DocumentOf<TName extends CollectionName = CollectionName> = TName extends unknown ? Source : never;
```

Defined in: [content.ts:40](https://github.com/aayushbtw/tomekit/blob/main/packages/tomekit/src/content.ts#L40)

A document in the named collection, or in any collection. The generated types give its `metadata` and `body` the types from your config.

## Example

```ts
function title(post: DocumentOf<"posts">) {
  return post.metadata.title;
}
```
