Skip to content

Commit

Permalink
Add actual example implementation for StoreEnhancer to TS extraMethod…
Browse files Browse the repository at this point in the history
…s test (#3658)
  • Loading branch information
Andarist authored and timdorr committed Dec 15, 2019
1 parent 3ef60f6 commit c270330
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion test/typescript/enhancers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ function stateExtension() {
* Store enhancer that adds methods to the store.
*/
function extraMethods() {
const enhancer: StoreEnhancer<{ method(): string }> = null as any
const enhancer: StoreEnhancer<{ method(): string }> = createStore => (
...args
) => {
const store = createStore(...args)
store.method = () => 'foo'
return store
}

const store = createStore(reducer, enhancer)

Expand Down

0 comments on commit c270330

Please sign in to comment.