Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type input params to mutateAsync? #504

Open
samzmann opened this issue Sep 17, 2024 · 0 comments
Open

Type input params to mutateAsync? #504

samzmann opened this issue Sep 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@samzmann
Copy link

samzmann commented Sep 17, 2024

I have a table tickets with rows:

id
created_at: string
created_by: string
name: string
date: string

Some of these fields are populated automatically via triggers in the database so I don't want the user to pass them as parameters to insert. Instead, the insert parameters should be a subtype with only the name and date fileds:

type InsertTicketPayload = Pick<
  Database['public']['Tables']['tickets']['Insert'],
  'name' | 'date'
>

How can I type useInsertMutation (or modify my global Database type) such that the input to mutateAsync is of type InsertTicketPayload?

@samzmann samzmann added the bug Something isn't working label Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant