fix(ci): resolve TS build errors across all services

- recordings.routes.ts: cast req.params.id to string (express 5 typed params)
- recordings.service.ts: cast Record<string,unknown>[] via unknown first
- guilds.routes.ts: cast req.params.guildId to string (2 sites)
- transmitter.ts: capture pcmStream ref locally + re-acquire in drain callback

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
MythEclipse
2026-06-14 01:17:18 +07:00
co-authored by Claude
parent 92d73fe12d
commit c317cfb420
4 changed files with 11 additions and 7 deletions
@@ -31,7 +31,7 @@ export function createRecordingsRouter(): Router {
router.delete( router.delete(
"/recordings/:id", "/recordings/:id",
asyncHandler(async (req: Request, res: Response) => { asyncHandler(async (req: Request, res: Response) => {
const { id } = req.params; const id = req.params.id as string;
await recordingsService.deleteById(id); await recordingsService.deleteById(id);
res.json({ ok: true }); res.json({ ok: true });
}), }),
@@ -68,7 +68,7 @@ export class RecordingsService {
LIMIT ${limit + 1} LIMIT ${limit + 1}
`); `);
const items = rows.slice(0, limit) as RecordingRow[]; const items = rows.slice(0, limit) as unknown as RecordingRow[];
const hasMore = rows.length > limit; const hasMore = rows.length > limit;
const nextCursor = hasMore ? String(items[items.length - 1]!.created_at) : null; const nextCursor = hasMore ? String(items[items.length - 1]!.created_at) : null;
@@ -27,7 +27,7 @@ export function createGuildsRouter(): Router {
router.get( router.get(
"/:guildId/channels", "/:guildId/channels",
asyncHandler(async (req: Request, res: Response) => { asyncHandler(async (req: Request, res: Response) => {
const guildId = req.params.guildId; const guildId = req.params.guildId as string;
logger.debug({ guildId }, "Fetching text channels"); logger.debug({ guildId }, "Fetching text channels");
const channels = await getTextChannels(guildId); const channels = await getTextChannels(guildId);
res.json(channels); res.json(channels);
@@ -38,7 +38,7 @@ export function createGuildsRouter(): Router {
router.get( router.get(
"/:guildId/voice-channels", "/:guildId/voice-channels",
asyncHandler(async (req: Request, res: Response) => { asyncHandler(async (req: Request, res: Response) => {
const guildId = req.params.guildId; const guildId = req.params.guildId as string;
logger.debug({ guildId }, "Fetching voice channels"); logger.debug({ guildId }, "Fetching voice channels");
const channels = await getVoiceChannels(guildId); const channels = await getVoiceChannels(guildId);
res.json(channels); res.json(channels);
@@ -133,16 +133,20 @@ export class VoiceTransmitter {
const data = JSON.parse(message); const data = JSON.parse(message);
if (data.type === "pcm" && data.buffer) { if (data.type === "pcm" && data.buffer) {
const pcmBuffer = Buffer.from(data.buffer, "base64"); const pcmBuffer = Buffer.from(data.buffer, "base64");
const canContinue = this.pcmStream.write(pcmBuffer); const stream = this.pcmStream;
const canContinue = stream.write(pcmBuffer);
// Backpressure: queue until drain // Backpressure: queue until drain
if (!canContinue) { if (!canContinue) {
this.draining = true; this.draining = true;
this.pcmStream.once("drain", () => { stream.once("drain", () => {
this.draining = false; this.draining = false;
// Re-acquire stream reference (could have been replaced by restart)
const currentStream = this.pcmStream;
if (!currentStream) return;
// Flush queued chunks // Flush queued chunks
while (this.backpressureQueue.length > 0) { while (this.backpressureQueue.length > 0) {
const queued = this.backpressureQueue.shift()!; const queued = this.backpressureQueue.shift()!;
if (!this.pcmStream.write(queued)) break; if (!currentStream.write(queued)) break;
} }
}); });
} }