mirror of
https://github.com/Moepchi/webspeak3.git
synced 2026-12-01 00:42:49 +08:00
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:
1 parent
65813b6367
commit
f6170f0576
2 files changed
+9
-10
No files matched your search
+3
-5
@@ -1393,7 +1393,6 @@ function AppInner() {
|
||||
const [vadHangover, setVadHangover] = useState(() => loadNumberPref(VAD_HANGOVER_KEY, 0.3));
|
||||
const [outputDevices, setOutputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||
const [outputDeviceId, setOutputDeviceId] = useState("");
|
||||
const [outputDeviceLabel, setOutputDeviceLabel] = useState("System default");
|
||||
const [inputDevices, setInputDevices] = useState<MediaDeviceInfo[]>([]);
|
||||
const [inputDeviceId, setInputDeviceId] = useState(() => localStorage.getItem(INPUT_DEVICE_KEY) ?? "");
|
||||
const [playbackVolume, setPlaybackVolume] = useState(() => loadNumberPref(PLAYBACK_VOLUME_KEY, 1));
|
||||
@@ -1476,7 +1475,7 @@ function AppInner() {
|
||||
|
||||
useEffect(() => {
|
||||
activeTabRef.current = activeTab;
|
||||
if (activeTab !== "channel") {
|
||||
if (typeof activeTab === "number") {
|
||||
setPmThreads((prev) => {
|
||||
const thread = prev[activeTab];
|
||||
if (!thread || !thread.unread) return prev;
|
||||
@@ -2006,9 +2005,8 @@ function AppInner() {
|
||||
socketRef.current?.send(JSON.stringify({ type: "setOutputMuted", muted: !outputMutedRef.current }));
|
||||
};
|
||||
|
||||
const handleOutputDeviceChange = async (deviceId: string, label?: string) => {
|
||||
const handleOutputDeviceChange = async (deviceId: string) => {
|
||||
setOutputDeviceId(deviceId);
|
||||
setOutputDeviceLabel(label || (deviceId ? `Output ${deviceId.slice(0, 6)}` : "System default"));
|
||||
await audioPlayerRef.current?.setOutputDevice(deviceId);
|
||||
setSoundsOutputDevice(deviceId);
|
||||
};
|
||||
@@ -2016,7 +2014,7 @@ function AppInner() {
|
||||
const handlePickOutputDevice = async () => {
|
||||
try {
|
||||
const device = await pickAudioOutputDevice();
|
||||
if (device) await handleOutputDeviceChange(device.deviceId, device.label);
|
||||
if (device) await handleOutputDeviceChange(device.deviceId);
|
||||
} catch (error) {
|
||||
appendLog({ text: `Output device error: ${(error as Error).message}`, kind: "error" });
|
||||
}
|
||||
|
||||
+6
-5
@@ -61,13 +61,12 @@ export class MicCapture {
|
||||
private deviceId?: string;
|
||||
private echoCancellation: boolean;
|
||||
private noiseSuppression: boolean;
|
||||
private context: AudioContext;
|
||||
threshold: number;
|
||||
hangoverSeconds: number;
|
||||
|
||||
constructor(
|
||||
private context: AudioContext,
|
||||
options: MicCaptureOptions
|
||||
) {
|
||||
constructor(context: AudioContext, options: MicCaptureOptions) {
|
||||
this.context = context;
|
||||
this.onFrame = options.onFrame;
|
||||
this.onActivity = options.onActivity;
|
||||
this.onLevel = options.onLevel;
|
||||
@@ -222,8 +221,10 @@ export class AudioPlayer {
|
||||
private destination: MediaStreamAudioDestinationNode;
|
||||
private element: SinkableElement;
|
||||
private gain: GainNode;
|
||||
private context: AudioContext;
|
||||
|
||||
constructor(private context: AudioContext) {
|
||||
constructor(context: AudioContext) {
|
||||
this.context = context;
|
||||
this.destination = context.createMediaStreamDestination();
|
||||
this.gain = context.createGain();
|
||||
this.gain.connect(this.destination);
|
||||
|
||||
Reference in new issue
Block a user