@@ -11,11 +11,11 @@ describe('Derived', () => {
1111 test ( 'should instantiate app with derived state' , ( ) => {
1212 type State = {
1313 foo : string
14- upperFoo : Derive < State , string >
14+ upperFoo : string
1515 }
1616 const state : State = {
1717 foo : 'bar' ,
18- upperFoo : ( state ) => state . foo . toUpperCase ( ) ,
18+ upperFoo : derived ( ( state : State ) => state . foo . toUpperCase ( ) ) ,
1919 }
2020 const config = {
2121 state,
@@ -41,11 +41,11 @@ describe('Derived', () => {
4141 }
4242 type State = {
4343 foo : string
44- upperFoo : Derive < State , string | null >
44+ upperFoo : string
4545 }
4646 const state : State = {
4747 foo : 'bar' ,
48- upperFoo : ( state ) => state . foo . toUpperCase ( )
48+ upperFoo : derived ( ( state : State ) => state . foo . toUpperCase ( ) )
4949 }
5050
5151 const config = {
@@ -63,8 +63,6 @@ describe('Derived', () => {
6363 actions : typeof config . actions
6464 }
6565 interface Action < Input = void > extends IAction < Config , Input > { }
66- interface Derive < Parent extends IState , Value >
67- extends IDerive < Config , Parent , Value > { }
6866
6967 const app = new Overmind ( config )
7068 const trackStateTree = app . getTrackStateTree ( )
@@ -91,14 +89,14 @@ describe('Derived', () => {
9189
9290 test ( 'should dynamically add derived' , ( ) => {
9391 const addDerived : Action = ( { state } ) => {
94- state . upperFoo = derived < typeof state , string > ( ( state ) => state . foo . toUpperCase ( ) )
92+ state . upperFoo = derived ( ( state : State ) => state . foo . toUpperCase ( ) )
9593 }
9694 const changeFoo : Action = ( { state } ) => {
9795 state . foo = 'bar2'
9896 }
9997 type State = {
10098 foo : string
101- upperFoo : Derive < State , string > | null
99+ upperFoo : string
102100 }
103101 const state : State = {
104102 foo : 'bar' ,
@@ -146,16 +144,16 @@ describe('Derived', () => {
146144 }
147145 type State = {
148146 foo : string
149- upperFoo : Derive < State , ( ) => string >
147+ upperFoo : ( ) => string
150148 }
151149 const state : State = {
152150 foo : 'bar' ,
153- upperFoo : ( ) =>
151+ upperFoo : derived ( ( ) =>
154152 function ( ) {
155153 const state = this [ PROXY_TREE ] . state
156154
157155 return state . foo . toUpperCase ( )
158- } ,
156+ } ) ,
159157 }
160158
161159 const config = {
@@ -172,8 +170,7 @@ describe('Derived', () => {
172170 actions : typeof config . actions
173171 }
174172 interface Action < Input = void > extends IAction < Config , Input > { }
175- interface Derive < Parent extends IState , Value >
176- extends IDerive < Config , Parent , Value > { }
173+
177174
178175 const app = new Overmind ( config )
179176 const trackStateTree = app . getTrackStateTree ( )
@@ -196,11 +193,11 @@ describe('Derived', () => {
196193 }
197194 type State = {
198195 foo : string
199- upperFoo : Derive < State , string >
196+ upperFoo : string
200197 }
201198 const state : State = {
202199 foo : 'bar' ,
203- upperFoo : ( state ) => state . foo . toUpperCase ( ) ,
200+ upperFoo : derived ( ( state : State ) => state . foo . toUpperCase ( ) ) ,
204201 }
205202
206203 const config = {
@@ -217,8 +214,6 @@ describe('Derived', () => {
217214 actions : typeof config . actions
218215 }
219216 interface Action < Input = void > extends IAction < Config , Input > { }
220- interface Derive < Parent extends IState , Value >
221- extends IDerive < Config , Parent , Value > { }
222217
223218 const app = new Overmind ( config )
224219 const trackStateTree = app . getTrackStateTree ( )
@@ -239,11 +234,11 @@ describe('Derived', () => {
239234 expect . assertions ( 1 )
240235 type State = {
241236 foo : string
242- upperFoo : Derive < State , string >
237+ upperFoo : string
243238 }
244239 const state : State = {
245240 foo : 'bar' ,
246- upperFoo : ( state ) => state . foo . toUpperCase ( ) ,
241+ upperFoo : derived ( ( state : State ) => state . foo . toUpperCase ( ) ) ,
247242 }
248243 const changeFoo : Action = ( { state } ) => {
249244 state . foo = 'bar2'
0 commit comments