Redundant typing
Hey noob question here
I have a table definition here :
as you can see, I define the type of price here. In another file :
As you can see I am also defining types of args here, and setting values accordingly in "insert" part.
My question is : since I'm already defining types when doing the tables, can I use these types in the args ? so that I don't have to copy/paste types between table and args ?
5 Replies
Thanks for posting in <#1088161997662724167>.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.
- Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
- Use search.convex.dev to search Docs, Stack, and Discord all at once.
- Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI.
- Avoid tagging staff unless specifically instructed.
Thank you!
There is
schema.tables.whatever.validator.fields
You could do something like
or if you want to take any of them (eg for upsert)
Here's a real example if it helps
I'm trying this but I think I'm mistaken
is your schema the
defineSchema
from schema.ts
?
but yeah since in Convex "everything is Typescript", I suppose what you are suggesting should work one way or another for my codebase