Skip to content

Commit 3fb7821

Browse files
Fix TypeScript and linting errors: type annotations, import order, and unused params
Co-authored-by: alexthemitchell <[email protected]>
1 parent 4932580 commit 3fb7821

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/hooks/__tests__/useMultiVfoProcessor.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ global.AudioContext = jest.fn().mockImplementation(() => ({
1313
state: "running",
1414
resume: jest.fn().mockResolvedValue(undefined),
1515
close: jest.fn().mockResolvedValue(undefined),
16-
createBuffer: jest.fn((channels, length, rate) => ({
16+
createBuffer: jest.fn((_channels, _length, _rate) => ({
1717
copyToChannel: jest.fn(),
1818
})),
1919
createBufferSource: jest.fn(() => ({

src/hooks/useMultiVfoProcessor.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ import { useEffect, useRef, useCallback, useState } from "react";
99
import { MultiVfoProcessor } from "../lib/dsp/MultiVfoProcessor";
1010
import { FMDemodulatorPlugin } from "../plugins/demodulators/FMDemodulatorPlugin";
1111
import { useVfo, useStore } from "../store";
12+
import { VfoStatus } from "../types/vfo";
1213
import { createAudioContext, playAudioBuffer } from "../utils/webAudioUtils";
1314
import type { IQSample } from "../models/SDRDevice";
1415
import type { DemodulatorPlugin } from "../types/plugin";
1516
import type { VfoState } from "../types/vfo";
16-
import { VfoStatus } from "../types/vfo";
1717

1818
interface UseMultiVfoProcessorOptions {
1919
/** Hardware center frequency in Hz */
@@ -226,7 +226,7 @@ export function useMultiVfoProcessor(options: UseMultiVfoProcessorOptions): {
226226

227227
// Build VfoState array with demodulators
228228
const vfoStates: VfoState[] = activeVfos
229-
.map((vfo) => {
229+
.map((vfo): VfoState | null => {
230230
const demodulator = vfoDemodulators.current.get(vfo.id);
231231
if (!demodulator) {
232232
return null;

src/utils/webAudioUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export function playAudioBuffer(
5353

5454
// Create buffer
5555
const buffer = context.createBuffer(1, samples.length, sampleRate);
56-
buffer.copyToChannel(samples, 0);
56+
buffer.copyToChannel(samples as Float32Array<ArrayBuffer>, 0);
5757

5858
// Create source
5959
const source = context.createBufferSource();
@@ -90,7 +90,7 @@ export function createAudioBufferFromSamples(
9090
const buffer = context.createBuffer(channels, numFrames, sampleRate);
9191

9292
if (channels === 1) {
93-
buffer.copyToChannel(samples, 0);
93+
buffer.copyToChannel(samples as Float32Array<ArrayBuffer>, 0);
9494
} else if (channels === 2) {
9595
// For stereo, split samples into left and right
9696
const leftChannel = new Float32Array(numFrames);

0 commit comments

Comments
 (0)