Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

typescript support #7

Open
cesco69 opened this issue Oct 21, 2024 · 0 comments
Open

typescript support #7

cesco69 opened this issue Oct 21, 2024 · 0 comments

Comments

@cesco69
Copy link

cesco69 commented Oct 21, 2024

declare module 'postgres-bridge' {
    import { PoolConfig, Pool } from 'pg'; // Importing specific types from pg
    import postgres from 'postgres'; // Importing the default export from postgres module

    export class PostgresBridge {
        constructor(configuration: PoolConfig);
        /** Connect to the database */
        connect(): Promise<Pool>;
    }

    // Type alias for the default import of postgres module
    type PostgresLib = typeof postgres;

    /** 
     * Factory function to create a PostgresBridge instance 
     * @param postgres - the postgres library instance
     */
    export function createPostgresBridge(postgres: PostgresLib): typeof PostgresBridge;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant