Skip to content

Row level security type error for Rules, not accepting optional property in generated DataModel #738

@AtAFork

Description

@AtAFork

For the rules object (just like in the blog post) I'm trying to do const rules: Rules<QueryCtx, DataModel> = { and getting a type error:

Type ' my stuff here ...' does not satisfy the constraint 'GenericDataModel'.
  Property 'users' is incompatible with index signature.
    Type '{ document: { _id: Id<"users">; _creationTime: number; stripeSubscriptionStatus?: string | undefined ...' is not assignable to type 'GenericTableInfo'.
      Types of property 'document' are incompatible.
        Type '{ _id: Id<"users">; _creationTime: number; stripeSubscriptionStatus?: string | undefined; ... }' is not assignable to type 'GenericDocument'.
          Property 'stripeSubscriptionStatus' is incompatible with index signature.
            Type 'string | undefined' is not assignable to type 'Value'.
              Type 'undefined' is not assignable to type 'Value'.ts(2344)

My users table schema has stripeSubscriptionStatus: v.optional(v.string()),, which (from my understanding) is ok to do within a table schema in Convex

versions

    "convex": "^1.25.4",
    "convex-helpers": "^0.1.104",

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions