refactor: replace 'any' types with proper TypeScript interfaces
Major type safety improvements throughout the codebase: - Updated DEFAULT_CONFIG version to 4.2 - Replaced 'any' with proper types in systemd.ts: * displaySingleUpsStatus now uses IUpsConfig and NupstSnmp types * Fixed legacy config handling to use proper IUpsConfig format * Removed inline 'any' type annotations - Replaced 'any' with proper types in daemon.ts: * emergencyUps now properly typed as { ups: IUpsConfig, status: ISnmpUpsStatus } * Exported IUpsStatus interface for reuse * Added ISnmpUpsStatus import to disambiguate from daemon's IUpsStatus - Replaced 'any' with Record<string, unknown> in migration system: * Updated BaseMigration abstract class signatures * Updated MigrationRunner.run() signature * Updated migration-v4.0-to-v4.1.ts to use proper types * Migrations use Record<string, unknown> because they deal with unknown config schemas that are being upgraded Benefits: - TypeScript now catches type errors at compile time - Would have caught the ups.thresholds bug earlier - Better IDE autocomplete and type checking - More maintainable and self-documenting code
This commit is contained in:
@@ -32,7 +32,9 @@ export class MigrationRunner {
|
||||
* @param config - Raw configuration object to migrate
|
||||
* @returns Migrated configuration and whether migrations ran
|
||||
*/
|
||||
async run(config: any): Promise<{ config: any; migrated: boolean }> {
|
||||
async run(
|
||||
config: Record<string, unknown>,
|
||||
): Promise<{ config: Record<string, unknown>; migrated: boolean }> {
|
||||
let currentConfig = config;
|
||||
let anyMigrationsRan = false;
|
||||
|
||||
|
Reference in New Issue
Block a user