Skip to content

Commit b434419

Browse files
committed
refactor: remove redundant type annotations from JSDoc comments
TypeScript already provides type information through function signatures, making explicit {type} annotations in JSDoc redundant and prone to becoming outdated. This removes them in favor of simpler @param name descriptions.
1 parent ffeb851 commit b434419

File tree

5 files changed

+15
-48
lines changed

5 files changed

+15
-48
lines changed

apps/whispering/src/lib/services/ffmpeg/web.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,12 @@ import { FfmpegServiceErr } from './types';
66
* Creates a web-compatible FFmpeg service implementation.
77
* This service provides stub implementations that indicate FFmpeg operations
88
* are not supported in web environments.
9-
*
10-
* @returns {FfmpegService} A service object with methods that return appropriate
11-
* responses for web environments where FFmpeg is not available
129
*/
1310
export function createFfmpegServiceWeb(): FfmpegService {
1411
return {
1512
/**
1613
* Checks if FFmpeg is installed on the system.
1714
* Always returns false for web environments since FFmpeg is not available.
18-
*
19-
* @returns {Promise<Ok<boolean>>} Promise resolving to Ok(false)
2015
*/
2116
async checkInstalled() {
2217
// FFmpeg check is not available in web version, assume not installed
@@ -27,9 +22,8 @@ export function createFfmpegServiceWeb(): FfmpegService {
2722
* Attempts to compress an audio blob using FFmpeg.
2823
* Always returns an error for web environments since FFmpeg is not available.
2924
*
30-
* @param {Blob} _blob - The audio blob to compress (unused in web version)
31-
* @param {string} compressionOptions - The compression options to apply
32-
* @returns {FfmpegServiceErr} Error indicating compression is not available in web version
25+
* @param _blob - The audio blob to compress (unused in web version)
26+
* @param compressionOptions - The compression options to apply
3327
*/
3428
async compressAudioBlob(_blob: Blob, compressionOptions: string) {
3529
// Audio compression is not available in web version

apps/whispering/src/lib/services/notifications/desktop.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,13 @@ import {
1919
/**
2020
* Creates a desktop notification service implementation using Tauri's notification plugin.
2121
* Handles permission requests, notification display, and cleanup of active notifications.
22-
*
23-
* @returns {NotificationService} A notification service with notify and clear methods
2422
*/
2523
export function createNotificationServiceDesktop(): NotificationService {
2624
/**
2725
* Removes a notification by its numeric ID from the active notifications list.
2826
* Retrieves all active notifications, finds the matching one, and removes it if found.
2927
*
30-
* @param {number} id - The numeric ID of the notification to remove
31-
* @returns {Promise<Result<void, NotificationServiceError>>} Success result or error details
28+
* @param id - The numeric ID of the notification to remove
3229
*/
3330
const removeNotificationById = async (
3431
id: number,
@@ -64,8 +61,7 @@ export function createNotificationServiceDesktop(): NotificationService {
6461
* Generates a unique ID if none provided, requests permissions if needed,
6562
* removes any existing notification with the same ID, then sends the new notification.
6663
*
67-
* @param {UnifiedNotificationOptions} options - Notification configuration including title, description, and optional ID
68-
* @returns {Promise<Result<string, NotificationServiceError>>} The notification ID string or error details
64+
* @param options - Notification configuration including title, description, and optional ID
6965
*/
7066
async notify(options: UnifiedNotificationOptions) {
7167
const idStringified = options.id ?? nanoid();
@@ -100,8 +96,7 @@ export function createNotificationServiceDesktop(): NotificationService {
10096
* Clears a notification by its string ID.
10197
* Converts the string ID to a numeric hash and removes the corresponding notification.
10298
*
103-
* @param {string} idStringified - The string ID of the notification to clear
104-
* @returns {Promise<Result<void, NotificationServiceError>>} Success result or error details
99+
* @param idStringified - The string ID of the notification to clear
105100
*/
106101
clear: async (idStringified) => {
107102
const removeNotificationResult = await removeNotificationById(

apps/whispering/src/lib/services/notifications/web.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ import { NotificationServiceErr, toBrowserNotification } from './types';
77
/**
88
* Creates a web-based notification service that handles browser notifications
99
* with fallback support for extension-based notifications.
10-
*
11-
* @returns {NotificationService} A notification service instance with notify and clear methods
1210
*/
1311
export function createNotificationServiceWeb(): NotificationService {
1412
// Cache extension detection result
@@ -18,8 +16,6 @@ export function createNotificationServiceWeb(): NotificationService {
1816
/**
1917
* Detects if a browser extension is available for enhanced notification support.
2018
* Results are cached to avoid repeated detection attempts.
21-
*
22-
* @returns {Promise<boolean>} True if extension is available, false otherwise
2319
*/
2420
const detectExtension = async (): Promise<boolean> => {
2521
if (extensionChecked) return hasExtension;
@@ -38,8 +34,7 @@ export function createNotificationServiceWeb(): NotificationService {
3834
* Sends a notification using the best available method (extension or browser API).
3935
* Automatically handles permission requests and converts unified options to browser format.
4036
*
41-
* @param {UnifiedNotificationOptions} options - Notification configuration including title, body, and actions
42-
* @returns {Promise<Result<string, NotificationServiceError>>} Success with notification ID or error
37+
* @param options - Notification configuration including title, body, and actions
4338
*/
4439
async notify(options: UnifiedNotificationOptions) {
4540
const notificationId = options.id ?? nanoid();
@@ -110,8 +105,7 @@ export function createNotificationServiceWeb(): NotificationService {
110105
* Clears a notification by ID. Currently a no-op for browser notifications
111106
* as they don't provide a direct clear API.
112107
*
113-
* @param {string} id - The notification ID to clear
114-
* @returns {Promise<Result<undefined, NotificationServiceError>>} Success or error result
108+
* @param _id - The notification ID to clear (unused, browser notifications auto-dismiss)
115109
*/
116110
async clear(_id: string) {
117111
// Browser notifications don't have a direct clear API

apps/whispering/src/lib/services/recorder/cpal.ts

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,10 @@ type AudioRecording = {
3030
* Creates a CPAL recorder service that interfaces with Rust audio recording methods.
3131
* This service handles device enumeration, recording start/stop operations, and file management
3232
* for desktop audio recording using the CPAL library.
33-
*
34-
* @returns {RecorderService} A recorder service instance with methods for audio recording operations
3533
*/
3634
export function createCpalRecorderService(): RecorderService {
3735
/**
3836
* Enumerates available recording devices from the system.
39-
*
40-
* @returns {Promise<Result<Device[], RecorderServiceError>>} A promise that resolves to either a list of available devices or an error
4137
*/
4238
const enumerateDevices = async (): Promise<
4339
Result<Device[], RecorderServiceError>
@@ -61,8 +57,6 @@ export function createCpalRecorderService(): RecorderService {
6157
return {
6258
/**
6359
* Gets the current state of the recorder.
64-
*
65-
* @returns {Promise<Result<WhisperingRecordingState, RecorderServiceError>>} A promise that resolves to either 'RECORDING' or 'IDLE' state, or an error
6660
*/
6761
getRecorderState: async (): Promise<
6862
Result<WhisperingRecordingState, RecorderServiceError>
@@ -85,10 +79,8 @@ export function createCpalRecorderService(): RecorderService {
8579
* Starts a recording session with the specified parameters.
8680
* Handles device selection, fallback logic, and recording initialization.
8781
*
88-
* @param {CpalRecordingParams} params - Recording parameters including device ID, recording ID, output folder, and sample rate
89-
* @param {Object} callbacks - Callback functions for status updates
90-
* @param {Function} callbacks.sendStatus - Function to send status updates during the recording process
91-
* @returns {Promise<Result<DeviceAcquisitionOutcome, RecorderServiceError>>} A promise that resolves to device acquisition outcome or an error
82+
* @param params - Recording parameters including device ID, recording ID, output folder, and sample rate
83+
* @param callbacks - Callback functions for status updates
9284
*/
9385
startRecording: async (
9486
{
@@ -104,8 +96,6 @@ export function createCpalRecorderService(): RecorderService {
10496

10597
/**
10698
* Acquires a recording device, either the selected one or a fallback.
107-
*
108-
* @returns {Result<DeviceAcquisitionOutcome, RecorderServiceError>} The device acquisition result
10999
*/
110100
const acquireDevice = (): Result<
111101
DeviceAcquisitionOutcome,
@@ -207,9 +197,7 @@ export function createCpalRecorderService(): RecorderService {
207197
* Stops the current recording session and returns the recorded audio as a Blob.
208198
* Handles file reading, session cleanup, and resource management.
209199
*
210-
* @param {Object} callbacks - Callback functions for status updates
211-
* @param {Function} callbacks.sendStatus - Function to send status updates during the stop process
212-
* @returns {Promise<Result<Blob, RecorderServiceError>>} A promise that resolves to the recorded audio blob or an error
200+
* @param callbacks - Callback functions for status updates
213201
*/
214202
stopRecording: async ({
215203
sendStatus,
@@ -263,9 +251,7 @@ export function createCpalRecorderService(): RecorderService {
263251
* Cancels the current recording session and cleans up resources.
264252
* Deletes any temporary recording files and closes the recording session.
265253
*
266-
* @param {Object} callbacks - Callback functions for status updates
267-
* @param {Function} callbacks.sendStatus - Function to send status updates during the cancel process
268-
* @returns {Promise<Result<CancelRecordingResult, RecorderServiceError>>} A promise that resolves to the cancellation result or an error
254+
* @param callbacks - Callback functions for status updates
269255
*/
270256
cancelRecording: async ({
271257
sendStatus,
@@ -341,10 +327,8 @@ export const CpalRecorderServiceLive = createCpalRecorderService();
341327
* Wrapper function for Tauri invoke calls that handles errors consistently.
342328
* Converts Tauri invoke calls into Result types for better error handling.
343329
*
344-
* @template T - The expected return type from the Tauri command
345-
* @param {string} command - The Tauri command to invoke
346-
* @param {Record<string, unknown>} [args] - Optional arguments to pass to the command
347-
* @returns {Promise<Result<T, {name: 'TauriInvokeError', command: string, error: unknown}>>} A promise that resolves to either the command result or a structured error
330+
* @param command - The Tauri command to invoke
331+
* @param args - Optional arguments to pass to the command
348332
*/
349333
async function invoke<T>(command: string, args?: Record<string, unknown>) {
350334
return tryAsync({

apps/whispering/src/routes/(app)/(config)/recordings/+page.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@
5959
6060
/**
6161
* Returns a cell renderer for a date/time column using date-fns format.
62-
* @param {string} formatString - date-fns format string
63-
* @returns {(args: { getValue: () => string }) => string}
62+
*
63+
* @param formatString - date-fns format string
6464
*/
6565
function formattedCell(formatString: string) {
6666
return ({ getValue }: { getValue: () => string }) => {

0 commit comments

Comments
 (0)