Skip to content

Releases: venables/typed-route-handler

v1.1.0

12 Dec 11:33
06ba714
Compare
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
Compare
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
Compare
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
Compare
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
Compare
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.

v0.0.5 - Initial Release

22 Jan 13:34
ce26809
Compare
Choose a tag to compare

🎉 The initial release of typed-route-handler!