mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-03-02 05:36:38 +00:00
Enabled @typescript-eslint/no-unsafe-return eslint rule again
This commit is contained in:
@@ -11,7 +11,7 @@ export default class ColorGenerator {
|
||||
private readonly colors: Record<string, string>;
|
||||
|
||||
public constructor(private readonly storage: LocalStorage) {
|
||||
this.colors = this.storage.get<Record<string, string>>('colors') || {};
|
||||
this.colors = this.storage.get<Record<string, string>>('colors') ?? {};
|
||||
}
|
||||
|
||||
public readonly getColorForKey = (key: string) => {
|
||||
|
||||
@@ -4,10 +4,10 @@ const buildPath = (path: string) => `${PREFIX}.${path}`;
|
||||
export default class LocalStorage {
|
||||
public constructor(private readonly localStorage: Storage) {}
|
||||
|
||||
public readonly get = <T>(key: string): T => {
|
||||
public readonly get = <T>(key: string): T | undefined => {
|
||||
const item = this.localStorage.getItem(buildPath(key));
|
||||
|
||||
return item ? JSON.parse(item) : undefined;
|
||||
return item ? JSON.parse(item) as T : undefined;
|
||||
};
|
||||
|
||||
public readonly set = (key: string, value: any) => this.localStorage.setItem(buildPath(key), JSON.stringify(value));
|
||||
|
||||
Reference in New Issue
Block a user