Skip to content

Commit 852de5f

Browse files
committed
fix(types): MMKV wrapper - remove undefined, normalize to null
1 parent 8f21bf7 commit 852de5f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/storageWrappers/MMKVStorageWrapper.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,15 @@ import { PersistentStorage } from '../types';
1111
* });
1212
*
1313
*/
14-
export class MMKVStorageWrapper
15-
implements PersistentStorage<string | null | undefined> {
14+
export class MMKVStorageWrapper implements PersistentStorage<string | null> {
1615
private storage;
1716

1817
constructor(storage: MMKVStorageInterface) {
1918
this.storage = storage;
2019
}
2120

22-
getItem(key: string): Promise<string | null | undefined> {
23-
return this.storage.getItem(key);
21+
getItem(key: string): Promise<string | null> {
22+
return this.storage.getItem(key) || null;
2423
}
2524

2625
removeItem(key: string): Promise<void> {
@@ -34,7 +33,7 @@ export class MMKVStorageWrapper
3433
});
3534
}
3635

37-
setItem(key: string, value: string | null | undefined): Promise<void> {
36+
setItem(key: string, value: string | null): Promise<void> {
3837
return new Promise((resolve, reject) => {
3938
this.storage
4039
.setItem(key, value)

0 commit comments

Comments
 (0)