1
Fork 0

Explicitly use the AnonymizeUsernamesData type for Value.

This commit is contained in:
Bauke 2023-08-12 11:16:55 +02:00
parent 36bf5ece75
commit be5ccaf0c1
Signed by: Bauke
GPG Key ID: C1C0F29952BCF558
1 changed files with 6 additions and 3 deletions

View File

@ -1,6 +1,9 @@
import {createValue, type Value} from "@holllo/webextension-storage"; import {createValue, type Value} from "@holllo/webextension-storage";
import browser from "webextension-polyfill"; import browser from "webextension-polyfill";
import {type AnonymizeUsernamesData} from "./anonymize-usernames.js"; import {
type AnonymizeUsernamesData,
ReplacementType,
} from "./anonymize-usernames.js";
import {Data, Feature, MiscellaneousFeature} from "./enums.js"; import {Data, Feature, MiscellaneousFeature} from "./enums.js";
import {collectHideTopicsData} from "./hide-topics.js"; import {collectHideTopicsData} from "./hide-topics.js";
import {defaultKnownGroups} from "./known-groups.js"; import {defaultKnownGroups} from "./known-groups.js";
@ -75,12 +78,12 @@ export const storageValues = {
value: false, value: false,
storage: browser.storage.sync, storage: browser.storage.sync,
}), }),
[Feature.AnonymizeUsernames]: createValue({ [Feature.AnonymizeUsernames]: createValue<AnonymizeUsernamesData>({
deserialize: (input) => JSON.parse(input) as AnonymizeUsernamesData, deserialize: (input) => JSON.parse(input) as AnonymizeUsernamesData,
serialize: (input) => JSON.stringify(input), serialize: (input) => JSON.stringify(input),
key: Feature.AnonymizeUsernames, key: Feature.AnonymizeUsernames,
value: { value: {
replacementType: "numerical", replacementType: ReplacementType.Numerical,
}, },
storage: browser.storage.sync, storage: browser.storage.sync,
}), }),