Skip to content

Commit b059aaf

Browse files
committed
Properly type the return type of the storage deserializer
It's only a subset of the full state.
1 parent 142cf18 commit b059aaf

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

ui/frontend/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"stylelint-config-idiomatic-order": "^8.1.0",
7070
"stylelint-config-prettier": "^9.0.3",
7171
"stylelint-config-standard": "^24.0.0",
72+
"ts-essentials": "^9.0.0",
7273
"ts-jest": "^27.0.0",
7374
"ts-loader": "^9.2.3",
7475
"typescript": "^4.2.2",

ui/frontend/storage.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { merge } from 'lodash';
22
import { StoreEnhancer, StoreEnhancerStoreCreator } from 'redux';
3+
import { DeepPartial } from 'ts-essentials';
34

45
type SimpleStorage = Pick<Storage, 'getItem' | 'setItem'>;
56

67
interface Config<S> {
78
storageFactory: () => SimpleStorage;
89
serialize: (state: S) => string;
9-
deserialize: (state: string) => S;
10+
deserialize: (state: string) => DeepPartial<S>;
1011
}
1112

1213
export class InMemoryStorage {

ui/frontend/yarn.lock

+5
Original file line numberDiff line numberDiff line change
@@ -6157,6 +6157,11 @@ ts-easing@^0.2.0:
61576157
resolved "https://registry.yarnpkg.com/ts-easing/-/ts-easing-0.2.0.tgz#c8a8a35025105566588d87dbda05dd7fbfa5a4ec"
61586158
integrity sha512-Z86EW+fFFh/IFB1fqQ3/+7Zpf9t2ebOAxNI/V6Wo7r5gqiqtxmgTlQ1qbqQcjLKYeSHPTsEmvlJUDg/EuL0uHQ==
61596159

6160+
ts-essentials@^9.0.0:
6161+
version "9.1.2"
6162+
resolved "https://registry.yarnpkg.com/ts-essentials/-/ts-essentials-9.1.2.tgz#46db6944b73b4cd603f3d959ef1123c16ba56f59"
6163+
integrity sha512-EaSmXsAhEiirrTY1Oaa7TSpei9dzuCuFPmjKRJRPamERYtfaGS8/KpOSbjergLz/Y76/aZlV9i/krgzsuWEBbg==
6164+
61606165
ts-jest@^27.0.0:
61616166
version "27.1.2"
61626167
resolved "https://registry.yarnpkg.com/ts-jest/-/ts-jest-27.1.2.tgz#5991d6eb3fd8e1a8d4b8f6de3ec0a3cc567f3151"

0 commit comments

Comments
 (0)