Fix pre-existing TypeScript errors blocking CI build

npm run build runs tsc -b before vite build, and the Pages workflow uses it - these four errors were already present but never surfaced locally since testing here used vite build directly. Removes truly-dead outputDeviceLabel state (its value was never read, only the dropdown's own device list rendered labels), narrows the PmThread lookup to a proper number check, and replaces two constructor parameter properties with explicit fields (disallowed under erasableSyntaxOnly).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
MoepchiandClaude Sonnet 5 committed 2026-08-01 00:27:40 +02:00
1 parent 65813b6367
commit f6170f0576
2 files changed
+9 -10

No files matched your search

+3 -5
View File
@@ -1393,7 +1393,6 @@ function AppInner() {
const [vadHangover, setVadHangover] = useState(() => loadNumberPref(VAD_HANGOVER_KEY, 0.3)); const [vadHangover, setVadHangover] = useState(() => loadNumberPref(VAD_HANGOVER_KEY, 0.3));
const [outputDevices, setOutputDevices] = useState<MediaDeviceInfo[]>([]); const [outputDevices, setOutputDevices] = useState<MediaDeviceInfo[]>([]);
const [outputDeviceId, setOutputDeviceId] = useState(""); const [outputDeviceId, setOutputDeviceId] = useState("");
const [outputDeviceLabel, setOutputDeviceLabel] = useState("System default");
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]); const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
const [inputDeviceId, setInputDeviceId] = useState(() => localStorage.getItem(INPUT_DEVICE_KEY) ?? ""); const [inputDeviceId, setInputDeviceId] = useState(() => localStorage.getItem(INPUT_DEVICE_KEY) ?? "");
const [playbackVolume, setPlaybackVolume] = useState(() => loadNumberPref(PLAYBACK_VOLUME_KEY, 1)); const [playbackVolume, setPlaybackVolume] = useState(() => loadNumberPref(PLAYBACK_VOLUME_KEY, 1));
@@ -1476,7 +1475,7 @@ function AppInner() {
useEffect(() => { useEffect(() => {
activeTabRef.current = activeTab; activeTabRef.current = activeTab;
if (activeTab !== "channel") { if (typeof activeTab === "number") {
setPmThreads((prev) => { setPmThreads((prev) => {
const thread = prev[activeTab]; const thread = prev[activeTab];
if (!thread || !thread.unread) return prev; if (!thread || !thread.unread) return prev;
@@ -2006,9 +2005,8 @@ function AppInner() {
socketRef.current?.send(JSON.stringify({ type: "setOutputMuted", muted: !outputMutedRef.current })); socketRef.current?.send(JSON.stringify({ type: "setOutputMuted", muted: !outputMutedRef.current }));
}; };
const handleOutputDeviceChange = async (deviceId: string, label?: string) => { const handleOutputDeviceChange = async (deviceId: string) => {
setOutputDeviceId(deviceId); setOutputDeviceId(deviceId);
setOutputDeviceLabel(label || (deviceId ? `Output ${deviceId.slice(0, 6)}` : "System default"));
await audioPlayerRef.current?.setOutputDevice(deviceId); await audioPlayerRef.current?.setOutputDevice(deviceId);
setSoundsOutputDevice(deviceId); setSoundsOutputDevice(deviceId);
}; };
@@ -2016,7 +2014,7 @@ function AppInner() {
const handlePickOutputDevice = async () => { const handlePickOutputDevice = async () => {
try { try {
const device = await pickAudioOutputDevice(); const device = await pickAudioOutputDevice();
if (device) await handleOutputDeviceChange(device.deviceId, device.label); if (device) await handleOutputDeviceChange(device.deviceId);
} catch (error) { } catch (error) {
appendLog({ text: `Output device error: ${(error as Error).message}`, kind: "error" }); appendLog({ text: `Output device error: ${(error as Error).message}`, kind: "error" });
} }
+6 -5
View File
@@ -61,13 +61,12 @@ export class MicCapture {
private deviceId?: string; private deviceId?: string;
private echoCancellation: boolean; private echoCancellation: boolean;
private noiseSuppression: boolean; private noiseSuppression: boolean;
private context: AudioContext;
threshold: number; threshold: number;
hangoverSeconds: number; hangoverSeconds: number;
constructor( constructor(context: AudioContext, options: MicCaptureOptions) {
private context: AudioContext, this.context = context;
options: MicCaptureOptions
) {
this.onFrame = options.onFrame; this.onFrame = options.onFrame;
this.onActivity = options.onActivity; this.onActivity = options.onActivity;
this.onLevel = options.onLevel; this.onLevel = options.onLevel;
@@ -222,8 +221,10 @@ export class AudioPlayer {
private destination: MediaStreamAudioDestinationNode; private destination: MediaStreamAudioDestinationNode;
private element: SinkableElement; private element: SinkableElement;
private gain: GainNode; private gain: GainNode;
private context: AudioContext;
constructor(private context: AudioContext) { constructor(context: AudioContext) {
this.context = context;
this.destination = context.createMediaStreamDestination(); this.destination = context.createMediaStreamDestination();
this.gain = context.createGain(); this.gain = context.createGain();
this.gain.connect(this.destination); this.gain.connect(this.destination);