Comprehensive type safety improvements across all CLI handlers and daemon:
**Error handling type fixes:**
- Add 'error instanceof Error' checks before accessing error.message throughout
- Fix all error/retryError/stdError/upsError type assertions
- Replace direct error.message with proper type guards
**Switch case improvements:**
- Wrap case block declarations in braces to satisfy deno-lint
- Fix no-case-declarations warnings in CLI command handlers
**Null/undefined safety:**
- Add checks for config.snmp and config.thresholds before access
- Fix IUpsStatus lastStatusChange to handle undefined with default value
- Add proper null checks in legacy configuration paths
**Type annotations:**
- Add explicit type annotations to lambda parameters (groupId, updateAvailable, etc.)
- Add TUpsModel type cast for 'cyberpower' default
- Import and use INupstConfig type where needed
**Parameter type fixes:**
- Fix implicit 'any' type errors in array callbacks
- Add type annotations to filter/find/map parameters
Files modified:
- ts/cli.ts: config.snmp/thresholds null checks, unused error variable fixes
- ts/cli/group-handler.ts: 4 error.message fixes + 2 parameter type annotations
- ts/cli/service-handler.ts: 3 error.message fixes
- ts/cli/ups-handler.ts: 5 error.message fixes + config checks + TUpsModel import
- ts/daemon.ts: 8 error.message fixes + IUpsStatus lastStatusChange fix + updateAvailable type
- ts/nupst.ts: 1 error.message fix
- ts/systemd.ts: 5 error.message fixes + parameter type annotation
All tests passing (3/3 SNMP tests + 10/10 logger tests)
Type check: ✓ No errors
- Created deno.json configuration
- Updated all imports to use npm:net-snmp@3.20.0
- Changed all Node.js built-in imports to node: specifiers
- Updated all .js extensions to .ts in imports
- Created mod.ts as Deno entry point
- Ready for Phase 3: CLI simplification