chore(ui): clear settings and stats any bucket
Replace low-risk any usages in settings flows, paginator state handling, and chart helper code with concrete local types. Leave the remaining no-explicit-any backlog isolated to reader-specific files for the next passes. Validation: just ui lint
This commit is contained in:
+1
-1
@@ -129,7 +129,7 @@ export class EpubReaderPreferencesComponent implements OnDestroy {
|
||||
if (typeof value === "string") {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = value;
|
||||
} else {
|
||||
this.userSettings.ebookReaderSetting.fontFamily = null as any;
|
||||
this.userSettings.ebookReaderSetting.fontFamily = null;
|
||||
}
|
||||
this.readerPreferencesService.updatePreference(['ebookReaderSetting', 'fontFamily'], value);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ import {User, UserService, UserSettings} from '../user-management/user.service';
|
||||
import {MessageService} from 'primeng/api';
|
||||
import {TranslocoService} from '@jsverse/transloco';
|
||||
|
||||
type MutableSettingsBranch = Record<string, unknown>;
|
||||
|
||||
@Injectable({providedIn: 'root'})
|
||||
export class ReaderPreferencesService {
|
||||
private readonly userService = inject(UserService);
|
||||
@@ -22,9 +24,13 @@ export class ReaderPreferencesService {
|
||||
updatePreference(path: string[], value: unknown): void {
|
||||
if (!this.currentUser) return;
|
||||
|
||||
let target: any = this.currentUser.userSettings;
|
||||
let target = this.currentUser.userSettings as MutableSettingsBranch;
|
||||
for (let i = 0; i < path.length - 1; i++) {
|
||||
target = target[path[i]] ||= {};
|
||||
const next = target[path[i]];
|
||||
if (!next || typeof next !== 'object') {
|
||||
target[path[i]] = {};
|
||||
}
|
||||
target = target[path[i]] as MutableSettingsBranch;
|
||||
}
|
||||
target[path.at(-1)!] = value;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user