Skip to content

Commit de1dbcf

Browse files
author
Zack Story
authored
(types): flow fixes (#692)
1 parent 58e14d6 commit de1dbcf

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
"eslint": "^4.8.0",
5555
"eslint-plugin-flowtype": "^2.30.4",
5656
"eslint-plugin-import": "^2.2.0",
57-
"flow-bin": "^0.59.0",
57+
"flow-bin": "^0.64.0",
5858
"flow-copy-source": "^1.1.0",
5959
"husky": "^0.13.3",
6060
"lint-staged": "^3.4.0",

src/createPersistoid.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ export default function createPersistoid(config: PersistConfig): Persistoid {
1010
const whitelist: ?Array<string> = config.whitelist || null
1111
const transforms = config.transforms || []
1212
const throttle = config.throttle || 0
13-
const storageKey = `${config.keyPrefix !== undefined
14-
? config.keyPrefix
15-
: KEY_PREFIX}${config.key}`
13+
const storageKey = `${
14+
config.keyPrefix !== undefined ? config.keyPrefix : KEY_PREFIX
15+
}${config.key}`
1616
const storage = config.storage
1717
const serialize = config.serialize === false ? x => x : defaultSerialize
1818

1919
// initialize stateful values
2020
let lastState = {}
2121
let stagedState = {}
2222
let keysToProcess = []
23-
let timeIterator: ?number = null
23+
let timeIterator: ?IntervalID = null
2424
let writePromise = null
2525

2626
const update = (state: Object) => {
@@ -79,7 +79,8 @@ export default function createPersistoid(config: PersistConfig): Persistoid {
7979
}
8080

8181
function passWhitelistBlacklist(key) {
82-
if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist') return false
82+
if (whitelist && whitelist.indexOf(key) === -1 && key !== '_persist')
83+
return false
8384
if (blacklist && blacklist.indexOf(key) !== -1) return false
8485
return true
8586
}

src/persistStore.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ export default function persistStore(
6262
})
6363
}
6464
let boostrappedCb = cb || false
65-
let persistor = createStore(persistorReducer, undefined, options.enhancer)
65+
let persistor: Persistor = createStore(
66+
persistorReducer,
67+
undefined,
68+
options.enhancer
69+
)
6670

6771
persistor.purge = () => {
6872
let results = []

src/types.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// @flow
2+
import { REHYDRATE, REGISTER } from './constants'
23

34
export type PersistState = {
45
version: number,
@@ -48,7 +49,7 @@ export type Transform = {
4849
export type RehydrateErrorType = any
4950

5051
export type RehydrateAction = {
51-
type: 'redux-persist/REHYDRATE',
52+
type: typeof REHYDRATE,
5253
key: string,
5354
payload: ?Object,
5455
err: ?RehydrateErrorType,
@@ -60,7 +61,7 @@ export type Persistoid = {
6061
}
6162

6263
type RegisterAction = {
63-
type: 'redux-persist/REGISTER',
64+
type: typeof REGISTER,
6465
key: string,
6566
}
6667

@@ -74,6 +75,8 @@ type PersistorState = {
7475
type PersistorSubscribeCallback = () => any
7576

7677
export type Persistor = {
78+
pause: () => void,
79+
persist: () => void,
7780
purge: () => Promise<any>,
7881
flush: () => Promise<any>,
7982
+dispatch: PersistorAction => PersistorAction,

0 commit comments

Comments
 (0)