Parsing Postgres array

Trying to parse a Postgres array coming back like this: {ditchrider,ditchrider,ditchrider}. This is my query:
db
.select({
  userRole: user.role,
  soureRole: sql`ARRAY_AGG(${sourceRole.sourceRole})`.as('sourceRole'),
})
.from(user)
.innerJoin(sourceRole, eq(user.id, sourceRole.userId))
.groupBy(user.id)
.where(eq(user.id, input.userId));

.mapWith doesn't work.
Was this page helpful?