Skip to content

Commit

Permalink
Type-handling improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
WarstekHUN committed Feb 20, 2024
1 parent 16d6842 commit 061e161
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@ export class ZilaServer<T extends ZilaClient = ZilaClient> {
return this._status;
}

private _clients: Array<ZilaClient | T> = [];

private _clients: Array<T> = [];

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

this._clients.push(zilaSocket);
this._clients.push(zilaSocket as T);

if (this.serverEvents.onClientConnect) {
for (const cb of this.serverEvents.onClientConnect) {
Expand Down
2 changes: 1 addition & 1 deletion test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class MyClient extends ZilaClient {
describe("Non-Secure", () => {
let client: ZilaConnection;
let server: ZilaServer<MyClient>;
let clientSocket: ZilaClient;
let clientSocket: MyClient;

beforeAll(async () => {
server = new ZilaServer<MyClient>({
Expand Down

0 comments on commit 061e161

Please sign in to comment.