Flow is complaining about "persistStore.js" because it adds properties to the return value of react-redux's createStore. When Objects are created with properties in Flow, they are treated as sealed objects; adding properties like this is not allowed.
flow-bin: 0.57.3
redux-persist: 5.4.0
Error: node_modules/redux-persist/lib/persistStore.js.flow:67
67: persistor.purge = () => {
^^^^^ property `purge`. Property not found in
67: persistor.purge = () => {
^^^^^^^^^ object type
Error: node_modules/redux-persist/lib/persistStore.js.flow:78
78: persistor.flush = () => {
^^^^^ property `flush`. Property not found in
78: persistor.flush = () => {
^^^^^^^^^ object type
Error: node_modules/redux-persist/lib/persistStore.js.flow:89
89: persistor.pause = () => {
^^^^^ property `pause`. Property not found in
89: persistor.pause = () => {
^^^^^^^^^ object type
Error: node_modules/redux-persist/lib/persistStore.js.flow:112
112: if (boostrappedCb && persistor.getState().bootstrapped) {
^^^^^^^^^^^^ property `bootstrapped`. Property not found in possibly undefined value
112: if (boostrappedCb && persistor.getState().bootstrapped) {
^^^^^^^^^^^^^^^^^^^^ undefined
Error: node_modules/redux-persist/lib/persistStore.js.flow:118
118: persistor.persist = () => {
^^^^^^^ property `persist`. Property not found in
118: persistor.persist = () => {
^^^^^^^^^ object type
Error: node_modules/redux-persist/lib/persistStore.js.flow:124
124: return persistor
^^^^^^^^^ object type. This type is incompatible with the expected return type of
44: ): Persistor {
^^^^^^^^^ object type
Property `flush` is incompatible:
44: ): Persistor {
^^^^^^^^^ property `flush`. Property not found in
124: return persistor
^^^^^^^^^ object type
Error: node_modules/redux-persist/lib/persistStore.js.flow:124
124: return persistor
^^^^^^^^^ object type. This type is incompatible with the expected return type of
44: ): Persistor {
^^^^^^^^^ object type
Property `getState` is incompatible:
25: getState(): S;
^^^^^^^^^^^^^ function type. This type is incompatible with. See lib: flow-typed/npm/redux_v3.x.x.js:25
80: +getState: () => PersistorState,
^^^^^^^^^^^^^^^^^^^^ function type. See: node_modules/redux-persist/lib/types.js.flow:80
This parameter is incompatible:
65: let persistor = createStore(persistorReducer, undefined, options.enhancer)
^^^^^^^^^ undefined. This type is incompatible with
80: +getState: () => PersistorState,
^^^^^^^^^^^^^^ object type. See: node_modules/redux-persist/lib/types.js.flow:80
Error: node_modules/redux-persist/lib/persistStore.js.flow:124
124: return persistor
^^^^^^^^^ object type. This type is incompatible with the expected return type of
44: ): Persistor {
^^^^^^^^^ object type
Property `purge` is incompatible:
44: ): Persistor {
^^^^^^^^^ property `purge`. Property not found in
124: return persistor
^^^^^^^^^ object type
Found 8 errors
Seeing this issue too
is there any way to unseal an object? We could I think spread it, but that seems an unnecessary cost just for the sake of appeasing flow.
also I am confused because I have redux-persist in use in a react-native project using flow 0.57.3 but am not seeing this error. Is there some confounding factor here that I am not aware of?
@rt2zz Sorry, I'm no longer working on the project where I saw this error.
If no one has a way to easily reproduce this, I'm fine closing it.
Most helpful comment
Seeing this issue too