fazlulkarimweb / with-next-redux-wrapper-redux-persist

A counter app(or boilerplate) with next redux wrapper, redux persist and redux thunk for your NEXT JS website.
164 stars 38 forks source link

Use with typescript #26

Open bryanltobing opened 2 years ago

bryanltobing commented 2 years ago

When i use this with typescript i need to add any type everywhere? could you please add an example with typescript ?

bsor-dev commented 2 years ago

+1

diegosaraviamamani commented 2 years ago

+2

AlexandreCassagne commented 2 years ago

+3

Effzz commented 2 years ago

+4

narendra087 commented 2 years ago

+5

hati8haha commented 2 years ago

typeof Type Operator can help you get type of store. Here is my solution:


export type AppStore = typeof store

interface IPersistStore extends AppStore {
  __persistor: Persistor
}

export const makeStore = (context?: Context): IPersistStore => {
  return { ...store, __persistor: persistStore(store) }
}

export const wrapper = createWrapper(makeStore)