Skip to content

Commit

Permalink
straighten out config type export
Browse files Browse the repository at this point in the history
  • Loading branch information
dangowans committed Apr 8, 2024
1 parent 630b201 commit 793b813
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import mssql from 'mssql';
export declare function connect(config: mssql.config): Promise<mssql.ConnectionPool>;
export type MSSQLConfig = mssql.config;
export declare function connect(config: MSSQLConfig): Promise<mssql.ConnectionPool>;
export declare function releaseAll(): Promise<void>;
export declare function getPoolCount(): number;
declare const _default: {
Expand All @@ -8,4 +9,4 @@ declare const _default: {
getPoolCount: typeof getPoolCount;
};
export default _default;
export type { config, IRecordSet, IResult, Transaction } from 'mssql';
export type { IRecordSet, IResult, Transaction } from 'mssql';
7 changes: 4 additions & 3 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ function getPoolKey(config: mssql.config): string {

let shutdownInitialized = false

export type MSSQLConfig = mssql.config

/**
* Connect to a MSSQL database.
* Creates a new connection if the configuration does not match a previously seen configuration.
* @param {mssql.config} config - MSSQL configuration.
* @param {MSSQLConfig} config - MSSQL configuration.
* @returns {mssql.ConnectionPool} - A MSSQL connection pool.
*/
export async function connect(
config: mssql.config
config: MSSQLConfig
): Promise<mssql.ConnectionPool> {
if (!shutdownInitialized) {
debugSQL('Initializing shutdown hooks.')
Expand Down Expand Up @@ -85,7 +87,6 @@ export default {
}

export type {
config,
IRecordSet,
IResult,
Transaction
Expand Down

0 comments on commit 793b813

Please sign in to comment.