~~ deno: true, lineWidth: 120 ~~
== should format as-is ==
const createGatewayManager = {} as any;

let gateway: any;
let workerId: number;

function spawnGateway(shardId: number, options: Partial<any>) {
  gateway = createGatewayManager({
    handleDiscordPayload: async function handleDiscordPayload(_: any, data: any, shardId: any) {
      const id = (data.t && ["GUILD_CREATE", "GUILD_DELETE", "GUILD_UPDATE"].includes(data.t)
        ? (data.d as any)?.id
        : (data.d as any)?.guild_id) ?? "000000000000000000";

      // IF FINAL SHARD BECAME READY TRIGGER NEXT WORKER
      if (data.t === "READY") {
        console.log(`[Worker #${workerId}]`, `[Worker] Shard #${shardId} online`);
      }
    },
  });
}

[expect]
const createGatewayManager = {} as any;

let gateway: any;
let workerId: number;

function spawnGateway(shardId: number, options: Partial<any>) {
  gateway = createGatewayManager({
    handleDiscordPayload: async function handleDiscordPayload(_: any, data: any, shardId: any) {
      const id = (data.t && ["GUILD_CREATE", "GUILD_DELETE", "GUILD_UPDATE"].includes(data.t)
        ? (data.d as any)?.id
        : (data.d as any)?.guild_id) ?? "000000000000000000";

      // IF FINAL SHARD BECAME READY TRIGGER NEXT WORKER
      if (data.t === "READY") {
        console.log(`[Worker #${workerId}]`, `[Worker] Shard #${shardId} online`);
      }
    },
  });
}
