Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ Per-package version history is maintained inside each package’s own `CHANGELOG

## [Unreleased]

### Changed

- Removed TypeBox compile-time type inference for `searchParams`, `params`, and `body` in client functions produced by `createClient`. Runtime validation with TypeBox remains supported, but `Static`-based inference is no longer used for client call signatures. [#54](https://github.com/aura-stack-ts/router/pull/54)

---

## [0.7.1] - 2026-06-04

### Changed

- Removed TypeBox compile-time type inference for `searchParams`, `params`, and `body` in endpoints and middlewares due to the performance cost of `Static` from the `typebox` package. Runtime validation with TypeBox remains supported. [#52](https://github.com/aura-stack-ts/router/pull/52)

---

## [0.7.0] - 2026-05-13
Expand Down
4 changes: 2 additions & 2 deletions src/@types/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { Type } from "arktype"
import type { ObjectSchema } from "valibot"
import type { Static, TSchema } from "typebox"
import type { RequestHeaders } from "@/@types/http.ts"
import type { infer as Infer } from "zod/v4/core"
import type { InferValibotSchema, SchemaKind, SupportedSchema } from "@/@types/schemas.ts"
Expand All @@ -11,7 +10,7 @@ export type InferSchema<T, Kind = SchemaKind<T>> = Kind extends "zod"
: Kind extends "valibot"
? InferValibotSchema<T & ObjectSchema<any, undefined>>
: Kind extends "typebox"
? Static<T & TSchema>
? {}
: [T] extends [Type<infer U>]
? U
: T
Expand Down Expand Up @@ -43,6 +42,7 @@ type InferContent<Config extends EndpointConfig<any, any, any>> =
? RemoveUndefined<ToInferSchema<Schemas>>
: unknown
: unknown

/**
* Generates a client type based on the provided route endpoints. Each endpoint's method and route are
* used to create a corresponding function to access the endpoint.
Expand Down
6 changes: 5 additions & 1 deletion test/client.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,11 @@ test("Client type inference with TypeBox schemas", async () => {
}
)

const router = createRouter([getItem, createItem, deleteItem])
const getItems = createEndpoint("GET", "/items", (ctx) => {
return ctx.json({ method: ctx.method })
})

const router = createRouter([getItem, createItem, deleteItem, getItems])

const client = createClient<typeof router>({
baseURL: "http://api.example.com",
Expand Down