Skip to content

Commit 820ab6e

Browse files
committed
Remove new keyword for function broadcasters
1 parent a382463 commit 820ab6e

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/echo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default class Echo<T extends keyof Broadcaster> {
4747
} else if (this.options.broadcaster == 'null') {
4848
this.connector = new NullConnector(this.options);
4949
} else if (typeof this.options.broadcaster == 'function') {
50-
this.connector = new this.options.broadcaster(this.options as EchoOptions<'function'>);
50+
this.connector = this.options.broadcaster(this.options as EchoOptions<'function'>);
5151
} else {
5252
throw new Error(
5353
`Broadcaster ${typeof this.options.broadcaster} ${this.options.broadcaster} is not supported.`
@@ -226,7 +226,7 @@ type Broadcaster = {
226226
connector: SocketIoConnector,
227227
public: SocketIoPublicChannel,
228228
private: SocketIoPrivateChannel,
229-
encrypted: any,
229+
encrypted: never,
230230
presence: SocketIoPresenceChannel,
231231
},
232232
'null': {

tests/echo.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ describe('Echo', () => {
2121
});
2222

2323
test('it will throw error for unsupported driver', () => {
24+
// @ts-ignore
2425
expect(() => new Echo({ broadcaster: 'foo' })).toThrowError('Broadcaster string foo is not supported.');
2526
});
2627
});

0 commit comments

Comments
 (0)