Skip to content

Comments

Storages#38

Open
sadcitizen wants to merge 38 commits intomasterfrom
feature/storages
Open

Storages#38
sadcitizen wants to merge 38 commits intomasterfrom
feature/storages

Conversation

@sadcitizen
Copy link
Member

No description provided.

@sadcitizen sadcitizen self-assigned this Oct 11, 2022
@sadcitizen sadcitizen changed the base branch from next to master January 14, 2024 07:13

export type TStorageValueDeserializer<T> = (raw: string) => T;

export interface IStorageService<TValue> {
Copy link
Contributor

@ancientbag ancientbag Nov 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если я правильно понимаю, то данный интерфейс нужен для того чтобы его заэкстендить в разных хранилищах (LocalStorage, ServiceStorage).
При текущей конструкции для обращения к хранилищам нужно заводить новые инстансы, т.к. методы getValue и setValue всегда возвращают дженерик TValue.
Так ли нужен этот дженерик? Я бы вынес дженерики из инстанса в методы getValue и setValue.
Таким образом инстанс хранилища можно было бы объявить один раз. И при использовании гет или сет, явно указывать возвращаемый тип

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants