Skip to content

Conversation

NamesMT
Copy link
Contributor

@NamesMT NamesMT commented Jul 17, 2025

Currently args are still required even though all of it's properties are optional, this change adds IsOptionalKey and AreAllPropertiesOptional util types, and use it to achieve "truly necessary requirement only" of args.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@thomasballinger
Copy link
Collaborator

This is a nice change but we're thinking we want to go the other direction here: we've found it gets complicated to write client-side middleware when it's all conditional on these optional types and would like to move to always requiring args.

This change doesn't make the situation any worse, so I'd like to take it, but it does cause some additional work for wrapping code like convex-helpers that hardcodes the exact optional approach used today.

Hold onto this for when we try out a single-object API for useQuery more like https://tkdodo.eu/blog/the-query-options-api; I think that would give us better separatioe between plumbing layers where middleware needs to e.g. insert an argument or consume an argument and the top usage layer where we can do things like this.

Let's not close this yet, when Ian gets back from PTO we can check, but I think this is the kind of thing that will cause type thrash and we wont' be stuck with it for too much longer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants