Fixing "any" type
This commit is contained in:
parent
9b702c75e3
commit
f8d462b0d7
@ -41,7 +41,7 @@ enum SockerIoEvent {
|
|||||||
BATCH = "batch",
|
BATCH = "batch",
|
||||||
}
|
}
|
||||||
|
|
||||||
function emitInBatch(socket: ExSocketInterface, event: string | symbol, payload: any): void {
|
function emitInBatch(socket: ExSocketInterface, event: string | symbol, payload: unknown): void {
|
||||||
socket.batchedMessages.push({ event, payload});
|
socket.batchedMessages.push({ event, payload});
|
||||||
|
|
||||||
if (socket.batchTimeout === null) {
|
if (socket.batchTimeout === null) {
|
||||||
@ -169,7 +169,7 @@ export class IoSocketController {
|
|||||||
const client : ExSocketInterface = socket as ExSocketInterface;
|
const client : ExSocketInterface = socket as ExSocketInterface;
|
||||||
client.batchedMessages = [];
|
client.batchedMessages = [];
|
||||||
client.batchTimeout = null;
|
client.batchTimeout = null;
|
||||||
client.emitInBatch = (event: string | symbol, payload: any): void => {
|
client.emitInBatch = (event: string | symbol, payload: unknown): void => {
|
||||||
emitInBatch(client, event, payload);
|
emitInBatch(client, event, payload);
|
||||||
}
|
}
|
||||||
this.sockets.set(client.userId, client);
|
this.sockets.set(client.userId, client);
|
||||||
|
@ -17,7 +17,7 @@ export interface ExSocketInterface extends Socket, Identificable {
|
|||||||
/**
|
/**
|
||||||
* Pushes an event that will be sent in the next batch of events
|
* Pushes an event that will be sent in the next batch of events
|
||||||
*/
|
*/
|
||||||
emitInBatch: (event: string | symbol, payload: any) => void;
|
emitInBatch: (event: string | symbol, payload: unknown) => void;
|
||||||
batchedMessages: Array<{ event: string | symbol, payload: any }>;
|
batchedMessages: Array<{ event: string | symbol, payload: unknown }>;
|
||||||
batchTimeout: NodeJS.Timeout|null;
|
batchTimeout: NodeJS.Timeout|null;
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ describe("PositionNotifier", () => {
|
|||||||
leaveTriggered = true;
|
leaveTriggered = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
let user1 = {
|
const user1 = {
|
||||||
id: "1",
|
id: "1",
|
||||||
position: {
|
position: {
|
||||||
x: 500,
|
x: 500,
|
||||||
@ -43,7 +43,7 @@ describe("PositionNotifier", () => {
|
|||||||
listenedZones: new Set<Zone>(),
|
listenedZones: new Set<Zone>(),
|
||||||
} as UserInterface;
|
} as UserInterface;
|
||||||
|
|
||||||
let user2 = {
|
const user2 = {
|
||||||
id: "2",
|
id: "2",
|
||||||
position: {
|
position: {
|
||||||
x: -9999,
|
x: -9999,
|
||||||
@ -117,7 +117,7 @@ describe("PositionNotifier", () => {
|
|||||||
leaveTriggered = true;
|
leaveTriggered = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
let user1 = {
|
const user1 = {
|
||||||
id: "1",
|
id: "1",
|
||||||
position: {
|
position: {
|
||||||
x: 500,
|
x: 500,
|
||||||
@ -128,7 +128,7 @@ describe("PositionNotifier", () => {
|
|||||||
listenedZones: new Set<Zone>(),
|
listenedZones: new Set<Zone>(),
|
||||||
} as UserInterface;
|
} as UserInterface;
|
||||||
|
|
||||||
let user2 = {
|
const user2 = {
|
||||||
id: "2",
|
id: "2",
|
||||||
position: {
|
position: {
|
||||||
x: -9999,
|
x: -9999,
|
||||||
|
@ -111,7 +111,7 @@ export interface UserMovesInterface {
|
|||||||
|
|
||||||
export interface BatchedMessageInterface {
|
export interface BatchedMessageInterface {
|
||||||
event: string,
|
event: string,
|
||||||
payload: any
|
payload: unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
export class Connection implements Connection {
|
export class Connection implements Connection {
|
||||||
|
Loading…
Reference in New Issue
Block a user