Node-mssql: ConnectionPool.healthy not present in @types/mssql

Created on 8 Jul 2020  Â·  3Comments  Â·  Source: tediousjs/node-mssql

Expected behaviour:

It should works as intended but in typescript I can't access this property, because it doesn't exist in the package @types/mssql

Configuration:

"dependencies": {
...
"mssql": "^6.2.0",
...
},
"devDependencies": {
...
"@types/mssql": "^6.0.3",
...
}

Error

TSError: ⨯ Unable to compile TypeScript:
src/config/db.ts(366,35): error TS2339: Property 'healthy' does not exist on type 'ConnectionPool'

Software versions

  • NodeJS: v12.16.1
  • node-mssql: 6.2.0

Most helpful comment

Sorry I thought you guys also maintained that package. My bad.

You can add some type declartion in the node_modules/@types/mssql like this.

@types/mssql/index.d.ts

export declare function query(command: TemplateStringsArray, ...interpolations: any[]): Promise<IResult<any>>;
export declare function connect(config: config | string, callback?: (err: any) => void): Promise<ConnectionPool>;
export declare function close(callback?: (err: any) => void): void;

Please refer to the node-mssql/lib/global-connection.js →

All 3 comments

Then that package will need updating

Sorry I thought you guys also maintained that package. My bad.

Sorry I thought you guys also maintained that package. My bad.

You can add some type declartion in the node_modules/@types/mssql like this.

@types/mssql/index.d.ts

export declare function query(command: TemplateStringsArray, ...interpolations: any[]): Promise<IResult<any>>;
export declare function connect(config: config | string, callback?: (err: any) => void): Promise<ConnectionPool>;
export declare function close(callback?: (err: any) => void): void;

Please refer to the node-mssql/lib/global-connection.js →

Was this page helpful?
0 / 5 - 0 ratings