Skip to content

Commit c5af6b0

Browse files
committed
More complete typings for createServer
1 parent 11879df commit c5af6b0

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

index.d.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import {
77
import * as mysql from './typings/mysql';
88
export * from './typings/mysql';
99

10-
import Server from './lib/server.js';
11-
1210
export interface Connection extends mysql.Connection {
1311
execute<
1412
T extends
@@ -201,4 +199,3 @@ export interface PoolOptions extends mysql.PoolOptions, ConnectionOptions {}
201199
export function createConnection(connectionUri: string): Connection;
202200
export function createConnection(config: ConnectionOptions): Connection;
203201
export function createPool(config: PoolOptions): Pool;
204-
export function createServer(handler: (conn: Connection) => any): Server;

typings/mysql/index.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import BaseQuery = require('./lib/protocol/sequences/Query');
1010
import BasePrepare = require('./lib/protocol/sequences/Prepare');
1111
import {QueryOptions, StreamOptions, QueryError} from './lib/protocol/sequences/Query';
1212
import {PrepareStatementInfo} from 'mysql2/typings/mysql/lib/protocol/sequences/Prepare';
13+
import Server from './lib/Server';
1314

1415
export function createConnection(connectionUri: string): Connection;
1516
export function createConnection(config: BaseConnection.ConnectionOptions): Connection;
@@ -41,4 +42,6 @@ export interface PoolConnection extends BasePoolConnection {}
4142
export interface Pool extends BasePool {}
4243
export interface PoolCluster extends BasePoolCluster {}
4344
export interface Query extends BaseQuery {}
44-
export interface Prepare extends BasePrepare {}
45+
export interface Prepare extends BasePrepare {}
46+
47+
export function createServer(handler: (conn: BaseConnection) => any): Server;

typings/mysql/lib/Server.d.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import { EventEmitter } from 'events';
2+
import Connection = require('./Connection');
3+
4+
declare namespace Server {}
5+
6+
declare class Server extends EventEmitter {
7+
connections: Array<Connection>;
8+
9+
listen(port: number): Server
10+
close(callback: (error: Error, count: number) => any): void
11+
}
12+
13+
export = Server;

0 commit comments

Comments
 (0)