richardsolomou / next-safe-route

Type-safe and validated Route Handlers for Next.js
https://npm.im/next-safe-route
MIT License
27 stars 3 forks source link

Query params are defined as any #5

Open bduff9 opened 1 month ago

bduff9 commented 1 month ago

Expected Behavior

I would expect anything defined with a zod schema to be defined per that schema, such as in the zsa library.

Actual Behavior

Currently, using the code below, invoicePath comes out as any despite it being defined as a string in my schema.

Steps to Reproduce the Problem

import { createSafeRoute } from 'next-safe-route';

import { z } from 'zod';

const querySchema = z.object({
    invoicePath: z.string(),
});

export const GET = createSafeRoute()
    .query(querySchema)
    .handler(async (_, context) => {
        const { invoicePath } = context.query;
        ...
    });

Specifications

richardsolomou commented 2 weeks ago

@bduff9 Hey, just released v0.0.20, could you check if this is still an issue? Thanks!