Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript: Schema instead of <K,V> #1

Closed
azu opened this issue Aug 8, 2020 · 0 comments · Fixed by #2
Closed

TypeScript: Schema instead of <K,V> #1

azu opened this issue Aug 8, 2020 · 0 comments · Fixed by #2

Comments

@azu
Copy link
Owner

azu commented Aug 8, 2020

Currently use <K,V> type for initializing.

export const kvsMemoryStorage = async <K extends KVSStorageKey, V extends JsonValue>(
    options: KvsLocalStorageOptions<K, V>
): Promise<KvsStorage<K, V>> => {
    return kvsStorage({
        ...options,
        storage: localstorage
    });
};

But, Schamea is useful, I Think

Reason

  • KVS needs to initialize. In other words, It is not a singleton
    • LocalStorage is a singleton
  • <K,V> is difficult to use correct type.

Related

@azu azu mentioned this issue Aug 8, 2020
@azu azu closed this as completed in #2 Aug 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant