Skip to content

Commit a2b5e26

Browse files
refactor(overmind): improve typing of derived
1 parent 5f88a8b commit a2b5e26

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/node_modules/overmind/src/derived.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ describe('Derived', () => {
9191

9292
test('should dynamically add derived', () => {
9393
const addDerived: Action = ({ state }) => {
94-
state.upperFoo = derived<Derive<typeof state, string>>((state) => state.foo.toUpperCase())
94+
state.upperFoo = derived<typeof state, string>((state) => state.foo.toUpperCase())
9595
}
9696
const changeFoo: Action = ({ state }) => {
9797
state.foo = 'bar2'

packages/node_modules/overmind/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ export { SERIALIZE, rehydrate } from './rehydrate'
7373

7474
export { Statemachine, statemachine } from './statemachine'
7575

76-
export const derived = <D extends IDerive<any, any, any>>(cb: D): D extends IDerive<any, any, infer U> ? U : never => cb as any
76+
export const derived = <S extends IState, V, C = Config>(cb: IDerive<C, S, V>): V => cb as any
7777

7878
/** This type can be overwriten by app developers if they want to avoid
7979
* typing and then they can import `Action`, `Operation` etc. directly from

0 commit comments

Comments
 (0)