Skip to content

Commit

Permalink
fix(types): MMKV wrapper - remove undefined, normalize to null
Browse files Browse the repository at this point in the history
  • Loading branch information
wodCZ committed Aug 12, 2021
1 parent 8f21bf7 commit 852de5f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/storageWrappers/MMKVStorageWrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ import { PersistentStorage } from '../types';
* });
*
*/
export class MMKVStorageWrapper
implements PersistentStorage<string | null | undefined> {
export class MMKVStorageWrapper implements PersistentStorage<string | null> {
private storage;

constructor(storage: MMKVStorageInterface) {
this.storage = storage;
}

getItem(key: string): Promise<string | null | undefined> {
return this.storage.getItem(key);
getItem(key: string): Promise<string | null> {
return this.storage.getItem(key) || null;
}

removeItem(key: string): Promise<void> {
Expand All @@ -34,7 +33,7 @@ export class MMKVStorageWrapper
});
}

setItem(key: string, value: string | null | undefined): Promise<void> {
setItem(key: string, value: string | null): Promise<void> {
return new Promise((resolve, reject) => {
this.storage
.setItem(key, value)
Expand Down

0 comments on commit 852de5f

Please sign in to comment.