adamA
Convex Community2y ago
3 replies
adam

Convex 1.13.0 missing optional in types

I seem to be encountering typescript errors when upgrading to convex 1.13.0.

Take await ctx.db.insert('messages', message); for example.

Here is the expected type that ctx.db.insert() expects for message:
// convex: 1.12.2
// convex-helpers: 0.1.43
{
  id?: string | undefined, 
  name?: string | undefined, 
  parentName?: string | undefined, 
  postId?: string | undefined, 
  author: string, 
  body: string
}

// convex: 1.13.0
// convex-helpers: 0.1.45
{
  id: string | undefined;
  name: string | undefined;
  parentName: string | undefined;
  postId: string | undefined;
  author: string;   
  body: string;   
}


await ctx.db.insert('messages', { author: 'Sam', body: 'test' }); is no longer valid because I need to explicitly define id, name, postId even though they can be
undefined
.

Is there a way to restore the previous optional behaviour?
Was this page helpful?