Skip to content

pg: PoolConfig missing verify option from pg-pool #74971

Description

@dmanto

Missing type

PoolConfig does not include the verify option, which is a documented feature of the underlying pg-pool package.

pg-pool source (pg-pool/index.js, lines 347–361):

if (isNew && this.options.verify) {
  this.options.verify(client, (err) => { ... })
}
// ...
if (isNew && this.options.verify) {
  this.options.verify(client, client.release)
}

Current PoolConfig (@types/pg 8.20.0, the latest):

export interface PoolConfig extends ClientConfig {
    // properties from module 'pg-pool'
    max?: number | undefined;
    min?: number | undefined;
    idleTimeoutMillis?: number | undefined | null;
    log?: ((...messages: any[]) => void) | undefined;
    Promise?: PromiseConstructorLike | undefined;
    allowExitOnIdle?: boolean | undefined;
    maxUses?: number | undefined;
    maxLifetimeSeconds?: number | undefined;
    Client?: (new() => ClientBase) | undefined;
    onConnect?: ((client: ClientBase) => void) | undefined;
    // verify is missing
}

Suggested fix

export interface PoolConfig extends ClientConfig {
    // ... existing properties ...
    verify?: ((client: PoolClient, done: (err?: Error) => void) => void) | undefined;
}

Impact

Without this type, any code using the verify hook must cast the entire Pool config object to any to avoid a TypeScript error, losing type-checking for all other pool options.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions