Skip to content

Commit 061e161

Browse files
committed
Type-handling improvement
1 parent 16d6842 commit 061e161

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/index.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ export class ZilaServer<T extends ZilaClient = ZilaClient> {
173173
return this._status;
174174
}
175175

176-
private _clients: Array<ZilaClient | T> = [];
176+
177+
private _clients: Array<T> = [];
177178

178179
public get clients() {
179180
return this._clients;
@@ -312,7 +313,7 @@ export class ZilaServer<T extends ZilaClient = ZilaClient> {
312313
req.headers.cookie ? new Map(Object.entries(parseCookie(req.headers.cookie))) : new Map()
313314
);
314315

315-
this._clients.push(zilaSocket);
316+
this._clients.push(zilaSocket as T);
316317

317318
if (this.serverEvents.onClientConnect) {
318319
for (const cb of this.serverEvents.onClientConnect) {

test/index.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class MyClient extends ZilaClient {
2929
describe("Non-Secure", () => {
3030
let client: ZilaConnection;
3131
let server: ZilaServer<MyClient>;
32-
let clientSocket: ZilaClient;
32+
let clientSocket: MyClient;
3333

3434
beforeAll(async () => {
3535
server = new ZilaServer<MyClient>({

0 commit comments

Comments
 (0)