Rune DarkfireR
Convex Community2y ago
11 replies
Rune Darkfire

Can't correctly type fields from a table to my NextTS application

This is more of a pure TS question than Convex, but at least it originates from the types of one of my convex function definitions. I'm getting this type error when trying to
build
my project (been fixing them by the dozens as we get ready for deployment) :
Type error: Type 'ReactMutation<FunctionReference<"mutation", "public", { id: Id<"documents">; orgId: string | null; storageId: Id<"_storage">; }, null, string | undefined>>' is not assignable to type '(params: { id: XOR<Id<"documents">, Id<"vendors">, Id<"contracts">, Id<"riskAssessments">>; orgId?: string | null | undefined; storageId?: string | undefined; }) => Promise<...>'.
  Types of parameters 'args' and 'params' are incompatible.
    Type '{ id: XOR<Id<"documents">, Id<"vendors">, Id<"contracts">, Id<"riskAssessments">>; orgId?: string | null | undefined; storageId?: string | undefined; }' is not assignable to type '{ id: Id<"documents">; orgId: string | null; storageId: Id<"_storage">; }'.
      Types of property 'id' are incompatible.
        Type 'XOR<Id<"documents">, Id<"vendors">, Id<"contracts">, Id<"riskAssessments">>' is not assignable to type 'Id<"documents">'.
          Type '{ [x: string]: undefined; [x: symbol]: undefined; readonly [x: number]: string; toString: () => string; charAt: (pos: number) => string; charCodeAt: (index: number) => number; concat: (...strings: string[]) => string; ... 48 more ...; __tableName: "documents"; }' is not assignable to type 'Id<"documents">'.
            Type '{ [x: string]: undefined; [x: symbol]: undefined; readonly [x: number]: string; toString: () => string; charAt: (pos: number) => string; charCodeAt: (index: number) => number; concat: (...strings: string[]) => string; ... 48 more ...; __tableName: "documents"; }' is not assignable to type 'string'.
Now obviously that is a huge mouthful.
Was this page helpful?