PostgreSQL - Type string is not assignable to type ConnectionOptions
Author: peterpeterparkerCreated Sep 14, 2026Updated Sep 14, 2026
Hi,
I'm following the documentation to setup BullMQ with PostgreSQL backend in a TypeScript project but, I cannot manage to find the proper types to define the connection.
On one hand, the ConnectionOptions seems to be unrelated to Postgre:
export type ConnectionOptions = RedisOptions | ClusterOptions | IRedisClient | RedisConnectionClient;on the other, it does not accept an inlined URL as showcased in the doc:
const opts = {
connection: "postgres://user:password@localhost:5432/mydb",
};
const queue = new Queue<any, any, string, PostgresQueueBackend>(
"my-queue",
opts,
createPostgresBackend,
);
// TS2345: Argument of type { connection: string; } is not assignable to parameter of type QueueOptions
// Types of property connection are incompatible.
// Type string is not assignable to type ConnectionOptionsGuessing the workaround is to define a connection option but, TypeScript wise, this equals to defining a RedisOptions object. Moreover, some fields seem untyped (schema, max).
Long story short, unless I might be something but, it feels like the types aren't set to accept a Postgre connection. Therefore, thought about reporting this.
Source: taskforcesh/bullmq