fix(server): use unknown in catch blocks

- file.ts, config.ts: Error | any is redundant (any swallows Error)
  and triggers no-explicit-any. Use unknown and cast only where
  needed (error.stack). Aligns with strict TypeScript and avoids
  masking real errors.
This commit is contained in:
pxmpsdev 2026-08-09 21:33:55 +00:00
parent 35c2a90fca
commit 8d6aeb8336
2 changed files with 3 additions and 3 deletions

View file

@ -67,7 +67,7 @@ const loadFromFile = async ({ metadataRepo, logger }: RepoDeps, filepath: string
try {
const file = await metadataRepo.readFile(filepath);
return loadYaml(file) as unknown;
} catch (error: Error | any) {
} catch (error: unknown) {
logger.error(`Unable to load configuration file: ${filepath}`);
logger.error(error);
throw error;

View file

@ -71,7 +71,7 @@ export const sendFile = async (
}
return await _sendFile(file.path, { dotfiles: 'allow' });
} catch (error: Error | any) {
} catch (error: unknown) {
// ignore client-closed connection
if (isConnectionAborted(error) || res.headersSent) {
return;
@ -79,7 +79,7 @@ export const sendFile = async (
// log non-http errors
if (!(error instanceof HttpException)) {
logger.error(`Unable to send file: ${error}`, error.stack);
logger.error(`Unable to send file: ${error}`, (error as Error).stack);
}
next(new NotFoundException());