Skip to content

Releases: venables/typed-route-handler

v3.1.0

29 Jul 18:40
4f91354

Choose a tag to compare

  • Fix peerDependencies to continue to list next >=15
  • Increase lint, typecheck strictness

Full Changelog: v3.0.2...v3.1.0

v3.0.2

29 Jul 18:40
b5c6092

Choose a tag to compare

  • 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

29 Jul 18:38
4df4f25

Choose a tag to compare

  • Fix publish steps

Full Changelog: v3.0.0...v3.0.1

v3.0.0

29 Jul 18:38
155d433

Choose a tag to compare

Full Changelog: v2.0.0...v3.0.0

v2.0.0

26 Jun 01:18
abcc10b

Choose a tag to compare

What's new

  • Seamless route handler param validation with zod (v3, v4) or valibot
    import { 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 Handler types, allowing simpler Param validation.
    - 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

12 Dec 11:33
06ba714

Choose a tag to compare

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

11 Dec 22:38
fd6f38a

Choose a tag to compare

What's Changed

  • Significantly reduce scope of the library to focus only on type-safety by @venables in #5

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 typedFetch method, as this was out of scope for the project and did not operate as the original fetch (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

11 Dec 22:35
a2d9598

Choose a tag to compare

What's Changed

  • Add support for Next.js 15 async params by @venables in #3

Full Changelog: v0.3.0...v0.4.0

v0.3.0

11 Jul 18:16
3de8eb1

Choose a tag to compare

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

Full Changelog: v0.2.4...v0.3.0

v0.1.1

22 Jan 13:35
ef7581d

Choose a tag to compare

  • [FIXED] Client-side typedFetch method is properly exported
  • [FIXED] Client-side types for typedFetch are properly included in the package.