fix: resolve all TypeScript strict null check errors
Fix ~68 pre-existing strict null errors across 13 feature modules. Add non-null assertions for DOM element lookups, null coalescing for optional values, and type guards for nullable properties. Zero tsc errors now with --noEmit.
This commit is contained in:
@@ -144,7 +144,7 @@ export function connectLogViewer(): void {
|
||||
}
|
||||
|
||||
const proto = location.protocol === 'https:' ? 'wss:' : 'ws:';
|
||||
const url = `${proto}//${location.host}/api/v1/system/logs/ws?token=${encodeURIComponent(apiKey)}`;
|
||||
const url = `${proto}//${location.host}/api/v1/system/logs/ws?token=${encodeURIComponent(apiKey ?? '')}`;
|
||||
|
||||
_logWs = new WebSocket(url);
|
||||
|
||||
@@ -321,7 +321,7 @@ export async function downloadBackup(): Promise<void> {
|
||||
// ─── Restore ───────────────────────────────────────────────
|
||||
|
||||
export async function handleRestoreFileSelected(input: HTMLInputElement): Promise<void> {
|
||||
const file = input.files[0];
|
||||
const file = input.files![0];
|
||||
input.value = '';
|
||||
if (!file) return;
|
||||
|
||||
@@ -438,7 +438,7 @@ export async function loadAutoBackupSettings(): Promise<void> {
|
||||
(document.getElementById('auto-backup-interval') as HTMLInputElement).value = String(data.interval_hours);
|
||||
(document.getElementById('auto-backup-max') as HTMLInputElement).value = data.max_backups;
|
||||
|
||||
const statusEl = document.getElementById('auto-backup-status');
|
||||
const statusEl = document.getElementById('auto-backup-status')!;
|
||||
if (data.last_backup_time) {
|
||||
const d = new Date(data.last_backup_time);
|
||||
statusEl.textContent = t('settings.auto_backup.last_backup') + ': ' + d.toLocaleString();
|
||||
@@ -476,7 +476,7 @@ export async function saveAutoBackupSettings(): Promise<void> {
|
||||
// ─── Saved backup list ────────────────────────────────────
|
||||
|
||||
export async function loadBackupList(): Promise<void> {
|
||||
const container = document.getElementById('saved-backups-list');
|
||||
const container = document.getElementById('saved-backups-list')!;
|
||||
try {
|
||||
const resp = await fetchWithAuth('/system/backups');
|
||||
if (!resp.ok) return;
|
||||
@@ -654,7 +654,7 @@ export async function downloadPartialExport(): Promise<void> {
|
||||
}
|
||||
|
||||
export async function handlePartialImportFileSelected(input: HTMLInputElement): Promise<void> {
|
||||
const file = input.files[0];
|
||||
const file = input.files![0];
|
||||
input.value = '';
|
||||
if (!file) return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user