---
layout: doc
title: Release of Kubb 4.0
description: Release notes for Kubb 4.0 covering new features, breaking changes and upgrade instructions.
outline: deep
image: /blog/v4/cover.svg
date: 2025-09-22
---

> Index of every page on this site: [llms.txt](https://kubb.dev/llms.txt)

# Introducing Kubb v4

Kubb v4 sharpens type safety, schema generation, and query handling. Here is what changed.

## Breaking changes

- Correct use of Infinite Query generics with Tanstack-Query
- Unwrap in Vue infinite query

### Different use of `z.optional`

::code-group

```typescript [Before]
z.number().int().optional()
```

```typescript [After]
z.optional(z.number().int())
```

::

### Add `Key` suffix to types when using `asConst`

::code-group

```typescript [Before]
export const findPetsByStatusQueryParamsStatusEnum = {
  available: 'available',
  pending: 'pending',
  sold: 'sold',
} as const

export type FindPetsByStatusQueryParamsStatusEnum = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum]
```

```typescript [After]
export const findPetsByStatusQueryParamsStatusEnum = {
  available: 'available',
  pending: 'pending',
  sold: 'sold',
} as const

export type FindPetsByStatusQueryParamsStatusEnumKey = (typeof findPetsByStatusQueryParamsStatusEnum)[keyof typeof findPetsByStatusQueryParamsStatusEnum]
```

::

👋🏽 [Stijn Van Hulle](https://twitter.com/stijnvanhulle)

## Sitemap

See the full [sitemap](https://kubb.dev/sitemap.md) for all pages.
