Export SOCKET_KEY from feathersjs/socket.io (#36099)

* Updated @feathersjs/socket-commons

* Fixed linting errors.

* Added type definitions for hook-less service methods.

* Revert "Added type definitions for hook-less service methods."

This reverts commit 14e8062a57f68b7c338ee092fb3e5cfea9e6f226.

See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/34684

* Improved service typings.

* Fixed tests.

* Fixed lint.

* Fixed typo.

* fix: Handle multiple dependent keys

* Updated header

* fix lint errors

* fix lint errors

* Added SOCKET_KEY export.

* Updated header.

* Removed unecessary imports.
This commit is contained in:
Desmond Koh
2019-07-01 08:30:17 -07:00
committed by Ben Lichtman
parent 7004a8e388
commit 712759ce5e
2 changed files with 15 additions and 6 deletions
@@ -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;
+12 -5
View File
@@ -1,12 +1,19 @@
// Type definitions for @feathersjs/socketio 3.0
// Project: https://feathersjs.com
// Definitions by: Jan Lohage <https://github.com/j2L4e>
// Desmond Koh <https://github.com/deskoh>
// Definitions: https://github.com/feathersjs-ecosystem/feathers-typescript
// TypeScript Version: 2.8
/// <reference types="feathersjs__socket-commons"/>
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;
}