diff --git a/CHANGELOG.md b/CHANGELOG.md index 550f37a..f3d9a17 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/@types/client.ts b/src/@types/client.ts index 0d776a0..2d3049c 100644 --- a/src/@types/client.ts +++ b/src/@types/client.ts @@ -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" @@ -11,7 +10,7 @@ export type InferSchema> = Kind extends "zod" : Kind extends "valibot" ? InferValibotSchema> : Kind extends "typebox" - ? Static + ? {} : [T] extends [Type] ? U : T @@ -43,6 +42,7 @@ type InferContent> = ? RemoveUndefined> : 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. diff --git a/test/client.test.ts b/test/client.test.ts index 0eee621..6a2d8a8 100644 --- a/test/client.test.ts +++ b/test/client.test.ts @@ -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({ baseURL: "http://api.example.com",