Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`InferProps` keeps `Promise` and `Response` for a `withValidator` loader

Open Beginner friendly
#478 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript

Research direction

Start by reading the defineHandler.withValidator return type and how InferProps reads __output. Add a type test for a loader that returns { book } or a Response, and check that InferProps<typeof loader> resolves to { book: Book } rather than a promise or response union.

Written by the indexing model from the issue text.

Description

InferProps gives the props of a defineHandler loader, but not of a defineHandler.withValidator one:

export const loader = defineHandler.withValidator({
  params: z.object({ id: z.string() }),
})(async (c, { params }) => {
  const book = await findBook(params.id);
  if (!book) return c.notFound();
  return { book };
});

type Props = InferProps<typeof loader>;
// expected: { book: Book }
// actual:   Promise<Response | { book: Book }>

defineHandler returns TypedHandler<{}, Exclude<Awaited<R>, Response>>, but withValidator returns TypedHandler<V, R> with the raw R. Routes don't notice, because the generated types wrap the output in Serialize<Awaited<…>>. InferProps reads __output directly, so it breaks.

Returning Exclude<Awaited<R>, Response> from withValidator too fixes it. Fix and a type test: https://github.com/ashunar0/void/commit/07c5352d58f880a0c77b78ce38aa5fb6fc832d5f

Happy to open a PR if that works for you.

Dominant language
TypeScript
Stars
402
Forks
32
Avg merge
12h 28m
Merged PRs (30d)
77

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from voidzero-dev/void

All issues in voidzero-dev/void

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.