From 52bde4982f4f477f815fb2a484c584c9cf9109c0 Mon Sep 17 00:00:00 2001 From: Andy Date: Wed, 14 Mar 2018 10:10:41 -0700 Subject: [PATCH] socket.io: Merge namespace with exported value (#24261) --- types/feathersjs__socketio/index.d.ts | 2 +- types/socket.io-redis/index.d.ts | 10 +++------- types/socket.io.users/index.d.ts | 7 +------ types/socket.io/index.d.ts | 8 ++------ types/socket.io/socket.io-tests.ts | 2 +- types/socketio-wildcard/index.d.ts | 2 +- 6 files changed, 9 insertions(+), 22 deletions(-) diff --git a/types/feathersjs__socketio/index.d.ts b/types/feathersjs__socketio/index.d.ts index 7ba889dfbe..f0e082bf45 100644 --- a/types/feathersjs__socketio/index.d.ts +++ b/types/feathersjs__socketio/index.d.ts @@ -4,8 +4,8 @@ // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.3 -/// /// +import SocketIO = require("socket.io"); export default function feathersSocketIO(callback?: (io: SocketIO.Server) => void): () => void; export default function feathersSocketIO(options: number | SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void; diff --git a/types/socket.io-redis/index.d.ts b/types/socket.io-redis/index.d.ts index 3de732084b..0335dcb300 100644 --- a/types/socket.io-redis/index.d.ts +++ b/types/socket.io-redis/index.d.ts @@ -4,14 +4,10 @@ // seeLuck // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +import SocketIO = require("socket.io"); -/// - -declare module 'socket.io-redis' { - let redis: SocketIORedisStatic; - - export = redis; -} +declare const SocketIORedis: SocketIORedisStatic; +export = SocketIORedis; interface SocketIORedisStatic { /** diff --git a/types/socket.io.users/index.d.ts b/types/socket.io.users/index.d.ts index 053d80450c..bfc16cd5a4 100644 --- a/types/socket.io.users/index.d.ts +++ b/types/socket.io.users/index.d.ts @@ -4,15 +4,10 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -/// - -/// -/// - - import { EventEmitter } from 'events'; import { Application } from "express"; import { SessionOptions } from "express-session"; +import SocketIO = require("socket.io"); declare var CONNECTION_EVENTS: string[]; declare var Middleware: () => (socket: SocketIO.Socket, next: () => any) => void; diff --git a/types/socket.io/index.d.ts b/types/socket.io/index.d.ts index 0d77110716..1583eac66b 100644 --- a/types/socket.io/index.d.ts +++ b/types/socket.io/index.d.ts @@ -5,11 +5,8 @@ /// -declare module 'socket.io' { - var server: SocketIOStatic; - - export = server; -} +declare const SocketIO: SocketIOStatic; +export = SocketIO; interface SocketIOStatic { /** @@ -45,7 +42,6 @@ interface SocketIOStatic { } declare namespace SocketIO { - interface Server { engine: { ws: any }; diff --git a/types/socket.io/socket.io-tests.ts b/types/socket.io/socket.io-tests.ts index cd0cecf6cf..7bfddb1271 100644 --- a/types/socket.io/socket.io-tests.ts +++ b/types/socket.io/socket.io-tests.ts @@ -2,7 +2,7 @@ import socketIO = require('socket.io'); function testUsingWithNodeHTTPServer() { var app = require('http').createServer(handler); - var io = socketIO(app); + var io: socketIO.Server = socketIO(app); var fs = require('fs'); app.listen(80); diff --git a/types/socketio-wildcard/index.d.ts b/types/socketio-wildcard/index.d.ts index 3170a27ca5..76598d59ae 100644 --- a/types/socketio-wildcard/index.d.ts +++ b/types/socketio-wildcard/index.d.ts @@ -3,8 +3,8 @@ // Definitions by: BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// /// +import SocketIO = require("socket.io"); import EventEmitter = NodeJS.EventEmitter; import Socket = SocketIO.Socket;