Releases: venables/typed-route-handler
Releases · venables/typed-route-handler
v3.1.0
v3.0.2
- Remove unnecessary peerDependencies (no need for valibot/zod explicitly listed due to standard-parse
Full Changelog: v3.0.1...v3.0.2
v3.0.1
- Fix publish steps
Full Changelog: v3.0.0...v3.0.1
v3.0.0
- Use standard-parse for schema parsing.
Full Changelog: v2.0.0...v3.0.0
v2.0.0
What's new
- Seamless route handler param validation with
zod(v3, v4) orvalibotimport { parseParams } from 'typed-route-handler/zod' import { NextResponse } from 'next/server' import * as z from 'zod/v4' const schema = z.object({ age: v.coerce.number() }) const GET: Handler<{ age: number }> = async (req, ctx) => { const { age } = await parseParams(ctx, schema) return NextResponse.json({ age }) })
- Cleaner
Handlertypes, allowing simplerParamvalidation.- export const GET: Handler<ResponseData, NextRouteContext<{ name: string }>> = async (req, context) => { + export const GET: Handler<ResponseData, { name: string }> = async (req, context) => {
- Comprehensive test suite
Full Changelog: v1.1.0...v2.0.0
v1.1.0
What's new
Recommended usage is as a type-only package. The package previously recommended wrapping your route handler in a
handler() method, which evolved to be a no-op. Starting in v1.1.0, the the documentation and exports have been updated to recommend usage as a type-only package. The handler method is still provided, but not recommended.
Because of this, typed-route-handler can be installed as a devDependency.
// app/api/[name]/route.ts
import { NextResponse } from "next/server"
import { type Handler, type NextRouteContext } from "typed-route-handler"
type ResponseData = {
name: string
}
type Context = NextRouteContext<{
name: string
}>
export const GET: Handler<ResponseData, Context> = async (req, context) => {
const { name } = await context.params
return NextResponse.json({
name
})
}v1.0.0
What's Changed
Breaking changes in v1.0.0
- Removed all automatic error handling. This was confusing and potentially dangerous if it swallowed errors. Error handling is often project-specific and trivial to implement (try/catch).
- Removed all error helpers, such as
unauthorized()which are included in Next v15.1 - Removed all route logging and timing. This is out of scope for the project
- Removed the client-side
typedFetchmethod, as this was out of scope for the project and did not operate as the originalfetch(it assume and parsed a JSON response and consumed the body, which was not ideal).
Full Changelog: v0.4.0...v1.0.0
v0.4.0
v0.3.0
What's Changed
- Fix bug in typed-fetch by @domleboss97 in #2
- Use biome, bun for linting, formatting, and testing instead of eslint, prettier, jest.
New Contributors
- @domleboss97 made their first contribution in #2
Full Changelog: v0.2.4...v0.3.0