Skip to content

Commit 8bcd8a7

Browse files
committed
refactor: Enhance type safety by replacing any with explicit types and renaming unused variables.
1 parent 1515ec0 commit 8bcd8a7

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/components/player/MediaPlayer.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export const MediaPlayer = ({ hiddenMode = false }: MediaPlayerProps) => {
161161
const {
162162
autoAdvanceBookmarks, selectedBookmarkId, getCurrentMediaBookmarks, loadBookmark,
163163
maxLoops, loopCount, setLoopCount, setIsLooping, loopDelay
164-
} = state as any;
164+
} = state;
165165

166166
// Increment loop counter
167167
const nextCount = (loopCount || 0) + 1;
@@ -173,8 +173,8 @@ export const MediaPlayer = ({ hiddenMode = false }: MediaPlayerProps) => {
173173
if (isDone) {
174174
// If auto-advance enabled, move to next bookmark
175175
if (autoAdvanceBookmarks && selectedBookmarkId) {
176-
const list = (getCurrentMediaBookmarks?.() || []).slice().sort((a: any, b: any) => a.start - b.start);
177-
const idx = list.findIndex((b: any) => b.id === selectedBookmarkId);
176+
const list = (getCurrentMediaBookmarks?.() || []).slice().sort((a, b) => a.start - b.start);
177+
const idx = list.findIndex((b) => b.id === selectedBookmarkId);
178178
if (list.length > 0) {
179179
const next = list[(idx + 1 + list.length) % list.length];
180180
if (next) {
@@ -293,7 +293,7 @@ export const MediaPlayer = ({ hiddenMode = false }: MediaPlayerProps) => {
293293
// Handle media ended
294294
const handleEnded = () => {
295295
console.log("Media playback ended");
296-
const state = usePlayerStore.getState() as any;
296+
const state = usePlayerStore.getState();
297297
if (state.isQueueActive) {
298298
state.playNextInQueue?.();
299299
return;

src/components/transcript/TranscriptPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { ExplanationDrawer } from "./ExplanationDrawer";
2626
import { useNavigate } from "react-router-dom";
2727
import { breakIntoSentences as utilBreakIntoSentences } from "../../utils/sentenceBreaker";
2828

29-
import { TranscriptSegment as TranscriptSegmentType } from "../../stores/playerStore";
29+
import { TranscriptSegment as TranscriptSegmentType, LoopBookmark } from "../../stores/playerStore";
3030
import { encodeWAV } from "../../utils/wavEncoder";
3131
import { Button } from "../ui/button";
3232
import { Input } from "../ui/input";
@@ -452,7 +452,7 @@ export const TranscriptPanel = () => {
452452
}
453453
};
454454

455-
const handleEditBookmark = (e: React.MouseEvent, bookmark: any) => {
455+
const handleEditBookmark = (e: React.MouseEvent, bookmark: LoopBookmark) => {
456456
e.stopPropagation();
457457
setEditingBookmarkId(bookmark.id);
458458
setEditName(bookmark.name);

src/stores/shadowingStore.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ export const useShadowingStore = create<ShadowingState & ShadowingActions>()(
9494
},
9595

9696
clearSegments: (mediaId) => set((state) => {
97-
const { [mediaId]: removed, ...rest } = state.sessions;
97+
const { [mediaId]: _removed, ...rest } = state.sessions;
9898
return { sessions: rest };
9999
}),
100100

@@ -107,7 +107,7 @@ export const useShadowingStore = create<ShadowingState & ShadowingActions>()(
107107

108108
// Clear the session state first
109109
set((state) => {
110-
const { [mediaId]: removed, ...rest } = state.sessions;
110+
const { [mediaId]: _removed, ...rest } = state.sessions;
111111
return { sessions: rest };
112112
});
113113

0 commit comments

Comments
 (0)