diff --git a/types/feathersjs__socketio/feathersjs__socketio-tests.ts b/types/feathersjs__socketio/feathersjs__socketio-tests.ts index 2e99e19f23..e40ec10897 100644 --- a/types/feathersjs__socketio/feathersjs__socketio-tests.ts +++ b/types/feathersjs__socketio/feathersjs__socketio-tests.ts @@ -1,5 +1,5 @@ import feathers, { Application } from '@feathersjs/feathers'; -import feathersSocketIO from '@feathersjs/socketio'; +import feathersSocketIO, { SOCKET_KEY } from '@feathersjs/socketio'; const app: Application = feathers(); @@ -8,3 +8,5 @@ app.configure(feathersSocketIO(io => {})); app.configure(feathersSocketIO({}, io => {})); app.configure(feathersSocketIO(1337, io => {})); app.configure(feathersSocketIO(1337, {}, io => {})); + +const key = SOCKET_KEY; diff --git a/types/feathersjs__socketio/index.d.ts b/types/feathersjs__socketio/index.d.ts index 94d926911e..67fca942ad 100644 --- a/types/feathersjs__socketio/index.d.ts +++ b/types/feathersjs__socketio/index.d.ts @@ -1,12 +1,19 @@ // Type definitions for @feathersjs/socketio 3.0 // Project: https://feathersjs.com // Definitions by: Jan Lohage +// Desmond Koh // Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript // TypeScript Version: 2.8 -/// -import SocketIO = require("socket.io"); +import * as io from '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; -export default function feathersSocketIO(port: number, options?: SocketIO.ServerOptions, callback?: (io: SocketIO.Server) => void): () => void; +declare const socketio: FeathersSocketIO; +export = socketio; + +interface FeathersSocketIO { + (callback?: (io: io.Server) => void): () => void; + (options: number | io.ServerOptions, callback?: (io: io.Server) => void): () => void; + (port: number, options?: io.ServerOptions, callback?: (io: io.Server) => void): () => void; + readonly SOCKET_KEY: unique symbol; + default: FeathersSocketIO; +}