Skip to content

Commit

Permalink
fix(types): MiddlewareAPI getState should have (this: void)
Browse files Browse the repository at this point in the history
Motivation:
The `getState` function provided by `MiddlewareAPI` is not bound to any
object, and as such it can be used freely as in the examples.

The `MiddlewareAPI` type does not make this explicit, and typescript
linters can report this as problematic usage.
  • Loading branch information
janeklb committed Sep 5, 2024
1 parent a3d153f commit f679f33
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { Dispatch } from './store'

export interface MiddlewareAPI<D extends Dispatch = Dispatch, S = any> {
dispatch: D
getState(): S
getState(this: void): S
}

/**
Expand Down

0 comments on commit f679f33

Please sign in to comment.