-
-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
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-apiversion: 24.4.1
RobinTail
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working