Description
When accessing undefined properties on the input object results in a never type instead of a TypeScript compilation error.
const helloWorldEndpoint = defaultEndpointsFactory.build({
input: z.object({
foo: z.string(),
}),
output: z.object({
foo: z.string(),
}),
handler: async ({ input: { bar, foo } }) => {
console.log(bar) // <----------------------- bar: never
return { foo };
},
});
Preferred Behavior
I'd prefer TypeScript to throw a clear compilation error such as:
Property 'foo' does not exist on type ...'
This would make debugging easier and catch typos at compile time rather than having to discover the never type through hovering or other means.
The never type essentially silences what should be a helpful TypeScript error, making it harder to catch mistakes during development.
Context
express-zod-api version: 24.4.1
Description
When accessing undefined properties on the
inputobject results in anevertype instead of a TypeScript compilation error.Preferred Behavior
I'd prefer TypeScript to throw a clear compilation error such as:
This would make debugging easier and catch typos at compile time rather than having to discover the
nevertype through hovering or other means.The
nevertype essentially silences what should be a helpful TypeScript error, making it harder to catch mistakes during development.Context
express-zod-apiversion: 24.4.1