Skip to content

Commit eee392e

Browse files
fix(overmind): properly type operator functions
1 parent 5bee55d commit eee392e

File tree

1 file changed

+6
-2
lines changed
  • packages/node_modules/overmind/src

1 file changed

+6
-2
lines changed

packages/node_modules/overmind/src/types.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ResolveActions, ResolveState } from './internalTypes'
22
import { Overmind } from './'
3+
import { IS_OPERATOR } from './utils'
34

45
/** ===== PUBLIC API
56
*/
@@ -44,11 +45,14 @@ export interface IAction<ThisConfig extends IConfiguration, Value> {
4445

4546
// We do not type operators as their low level implementation, but rather
4647
// how it is consumed by the developer
47-
export type IOperator<
48+
export interface IOperator<
4849
ThisConfig extends IConfiguration,
4950
Input,
5051
Output = Input
51-
> = (context: IContext<ThisConfig>, value: Input) => Output
52+
> {
53+
(context: IContext<ThisConfig>, value: Input): Output
54+
[IS_OPERATOR]: true
55+
}
5256

5357
export type IDerive<
5458
ThisConfig extends IConfiguration,

0 commit comments

Comments
 (0)