-
-
Notifications
You must be signed in to change notification settings - Fork 127
Description
Environment
Node v22.15.0
orpc v1.13.2
Reproduction
NestJS + orpc example: https://github.com/unnoq/orpc/tree/main/playgrounds/nest
Describe the bug
When running the example NestJS repo and trying to use the orpc client with useQuery the input objects accepts any key values. Is this intentional or a bug?
From the provided NestJS example code
// contract/planet.ts
export const listPlanets = oc
.route({
method: 'GET',
path: '/planets',
summary: 'List all planets',
tags: ['Planets'],
})
.input(
z.object({
limit: z.number().int().min(1).max(100).default(10),
cursor: z.number().int().min(0).default(0),
}),
)
.output(z.array(PlanetSchema))
// playground-tanstack-query.ts
import { orpc } from './lib/orpc'
import { useQuery } from '@tanstack/react-query'
const {data} = useQuery(orpc.planet.list.queryOptions({input: {cursor: 1, limit: 12, test: "123"}}))
In the above code TS compiler does not raise a error Object literal may only specify known properties for key value test: "123" eventhough it is not defined in the contract. However if I use useMutation. In the mutate function, it does raise an error if I provide an unknown key value. Comming from trpc this is very unintuitive for me since there when using useQuery with trpc client i would allways get an error if specifying unknown values for the input.
Additional context
No response
