fix --noimplicitany compatibility issue

This commit is contained in:
Sandor 2015-01-16 11:20:37 +01:00
parent b8ca52c698
commit 291f5b6536
2 changed files with 35 additions and 30 deletions

View File

@ -7,7 +7,7 @@
"use strict";
import tediousConnectionPool = require("tedious-connection-pool");
import ConnectionPool = require("tedious-connection-pool");
import tedious = require("tedious");
var config: tedious.ConnectionConfig = {
@ -20,18 +20,18 @@ var config: tedious.ConnectionConfig = {
}
};
var poolConfig : tediousConnectionPool.PoolConfig = {
var poolConfig : ConnectionPool.PoolConfig = {
min: 1,
max: 4
};
var pool: tediousConnectionPool.ConnectionPool = new tediousConnectionPool(poolConfig, config);
var pool: ConnectionPool = new ConnectionPool(poolConfig, config);
pool.on('error', (err: Error) => {
console.error(err);
});
pool.acquire((err: Error, connection: tediousConnectionPool.PooledConnection) =>{
pool.acquire((err: Error, connection: ConnectionPool.PooledConnection) =>{
console.log("hurray");
connection.beginTransaction((error: Error): void => {}, "some name");
connection.rollbackTransaction((error: Error): void => {});

View File

@ -68,37 +68,42 @@ declare module "tedious-connection-pool" {
acquireTimeout?: number;
}
/**
* Tedious Connection Pool Interface
*/
export interface ConnectionPool {
/**
* acquires a connection from the pool
* @param callback invoked when the connection is retrieved and ready
*/
acquire(callback:ConnectionCallback):void;
/**
* listens for a specific connection pool event
* @param event the event name
* @param callback invoked when the event is raised
*/
on(event:string, callback:Function):void;
/**
* closes opened connections
*/
drain():void;
}
}
/**
* Connection Pool constructor
* @param poolConfig the pool configuration
* @param connectionConfig the connection configuration
* Tedious Connection Pool Class
*/
function tcp(poolConfig:tcp.PoolConfig, connectionConfig:any): void;
class tcp {
/**
* Connection Pool constructor
* @param poolConfig the pool configuration
* @param connectionConfig the connection configuration
*/
constructor(poolConfig:tcp.PoolConfig, connectionConfig:tedious.ConnectionConfig);
/**
* acquires a connection from the pool
* @param callback invoked when the connection is retrieved and ready
*/
acquire(callback:tcp.ConnectionCallback):void;
/**
* listens for a specific connection pool event
* @param event the event name
* @param callback invoked when the event is raised
*/
on(event:string, callback:Function):void;
/**
* closes opened connections
*/
drain():void;
}
export = tcp;
}