Error with JSONB Column in SQL Insert Using Effect Typescript Library

Hi all!

Does sql not support jsonb columns? I've got something like this to insert, how can i make it happen?

class Person extends Schema.Class<Person>("Person")({
    id: Schema.Number,
    name: Schema.Redacted(Schema.String),
    createdAt: Schema.DateFromSelf,
    updatedAt: Schema.DateFromSelf,
    team: Schema.Array(
        Schema.Struct({
            id: Schema.Number,
            name: Schema.String,
        }),
    ),
}) {}

const CreatePerson = yield* SqlResolver.ordered("InsertOrganization", {
    Request: Person,
    Result: Person,
    execute: (requests) =>
        sql`INSERT INTO people ${sql.insert(requests)} RETURNING *`, --> Getting error here Property 'team' is incompatible with index signature.
          Type 'readonly { readonly id: number; readonly name: string; }[]' is not assignable to type 'Primitive | Fragment | undefined'.
});


Here team is the jsonb column
Was this page helpful?