Skip to content

Commit

Permalink
ts: Improve LocalStorage type definition
Browse files Browse the repository at this point in the history
  • Loading branch information
radex committed Apr 21, 2024
1 parent 5d51677 commit b14e962
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG-Unreleased.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### Fixes

- [ts] Improved LocalStorage type definition

### Performance

### Changes
Expand Down
4 changes: 2 additions & 2 deletions src/Database/LocalStorage/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export default class LocalStorage {

// Get value from LocalStorage (returns value deserialized from JSON)
// Returns `undefined` if not found
get<ValueType>(key: LocalStorageKey<ValueType>): Promise<ValueType | void>
get<ValueType>(key: LocalStorageKey<ValueType>): Promise<ValueType | undefined>

// Experimental: Same as get(), but can be called synchronously
_getSync<ValueType>(
key: LocalStorageKey<ValueType>,
callback: (value: ValueType | void) => void,
callback: (value: ValueType | undefined) => void,
): void

// Set value to LocalStorage
Expand Down

0 comments on commit b14e962

Please sign in to comment.