diff --git a/lib/index.ts b/lib/index.ts index 981fef9ade..c74d065f59 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -1,10 +1,10 @@ -import http from "http"; +import http = require("http"); import { createReadStream } from "fs"; import { createDeflate, createGzip, createBrotliCompress } from "zlib"; import accepts = require("accepts"); import { pipeline } from "stream"; -import path from "path"; -import engine from "engine.io"; +import path = require("path"); +import engine = require("engine.io"); import { Client } from "./client"; import { EventEmitter } from "events"; import { ExtendedError, Namespace } from "./namespace"; diff --git a/lib/namespace.ts b/lib/namespace.ts index e85c0cd019..f445cff7a9 100644 --- a/lib/namespace.ts +++ b/lib/namespace.ts @@ -178,11 +178,10 @@ export class Namespace extends EventEmitter { /** * Emits to all clients. * - * @return {Namespace} self + * @return {Boolean} Always true * @public */ - // @ts-ignore - public emit(ev: string, ...args: any[]): Namespace { + public emit(ev: string, ...args: any[]): boolean { if (RESERVED_EVENTS.has(ev)) { throw new Error(`"${ev}" is a reserved event name`); } @@ -209,7 +208,7 @@ export class Namespace extends EventEmitter { flags: flags }); - return this; + return true; } /** diff --git a/lib/parent-namespace.ts b/lib/parent-namespace.ts index b447b934eb..88d07df80a 100644 --- a/lib/parent-namespace.ts +++ b/lib/parent-namespace.ts @@ -10,7 +10,7 @@ export class ParentNamespace extends Namespace { _initAdapter() {} - public emit(...args): Namespace { + public emit(...args: any[]): boolean { this.children.forEach(nsp => { nsp._rooms = this._rooms; nsp._flags = this._flags; @@ -19,7 +19,7 @@ export class ParentNamespace extends Namespace { this._rooms.clear(); this._flags = {}; - return this; + return true; } createChild(name) { diff --git a/lib/socket.ts b/lib/socket.ts index b06837d77b..57ef148874 100644 --- a/lib/socket.ts +++ b/lib/socket.ts @@ -1,6 +1,6 @@ import { EventEmitter } from "events"; import { PacketType } from "socket.io-parser"; -import url from "url"; +import url = require("url"); import debugModule from "debug"; import { Server } from "./index"; import { Client } from "./client"; @@ -129,11 +129,10 @@ export class Socket extends EventEmitter { /** * Emits to this client. * - * @return {Socket} self + * @return {Boolean} Always true * @public */ - // @ts-ignore - public emit(ev: string, ...args: any[]) { + public emit(ev: string, ...args: any[]): boolean { if (RESERVED_EVENTS.has(ev)) { throw new Error(`"${ev}" is a reserved event name`); } @@ -171,7 +170,7 @@ export class Socket extends EventEmitter { // dispatch packet this.packet(packet, flags); } - return this; + return true; } /** diff --git a/tsconfig.json b/tsconfig.json index 68e03b91c1..c21970279b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "outDir": "./dist", - "allowJs": true, "target": "es2017", "module": "commonjs", "declaration": true,