1- import { Transaction , State , TransactionType , StateUpdateEvent , TransactionEventOrigin } from './transaction' ;
1+ import { Transaction , State , TransactionType , StateUpdateEvent , TransactionEventOrigin , Action } from './transaction' ;
22import { IgxBaseTransactionService } from './base-transaction' ;
33import { EventEmitter , Injectable } from '@angular/core' ;
44import { isObject , mergeObjects , cloneValue } from '../../core/utils' ;
55
66@Injectable ( )
77export class IgxTransactionService < T extends Transaction , S extends State > extends IgxBaseTransactionService < T , S > {
88 protected _transactions : T [ ] = [ ] ;
9- protected _redoStack : { transaction : T , recordRef : any } [ ] [ ] = [ ] ;
10- protected _undoStack : { transaction : T , recordRef : any } [ ] [ ] = [ ] ;
9+ protected _redoStack : Action < T > [ ] [ ] = [ ] ;
10+ protected _undoStack : Action < T > [ ] [ ] = [ ] ;
1111 protected _states : Map < any , S > = new Map ( ) ;
1212
1313 /**
@@ -116,7 +116,7 @@ export class IgxTransactionService<T extends Transaction, S extends State> exten
116116 public endPending ( commit : boolean ) : void {
117117 this . _isPending = false ;
118118 if ( commit ) {
119- const actions : { transaction : T , recordRef : any } [ ] = [ ] ;
119+ const actions : Action < T > [ ] = [ ] ;
120120 // don't use addTransaction due to custom undo handling
121121 for ( const transaction of this . _pendingTransactions ) {
122122 const pendingState = this . _pendingStates . get ( transaction . id ) ;
@@ -179,7 +179,7 @@ export class IgxTransactionService<T extends Transaction, S extends State> exten
179179 return ;
180180 }
181181
182- const lastActions : { transaction : T , recordRef : any } [ ] = this . _undoStack . pop ( ) ;
182+ const lastActions : Action < T > [ ] = this . _undoStack . pop ( ) ;
183183 this . _transactions . splice ( this . _transactions . length - lastActions . length ) ;
184184 this . _redoStack . push ( lastActions ) ;
185185
@@ -198,7 +198,7 @@ export class IgxTransactionService<T extends Transaction, S extends State> exten
198198 */
199199 public redo ( ) : void {
200200 if ( this . _redoStack . length > 0 ) {
201- let actions : { transaction : T , recordRef : any , useInUndo ?: boolean } [ ] ;
201+ let actions : Action < T > [ ] ;
202202 actions = this . _redoStack . pop ( ) ;
203203 for ( const action of actions ) {
204204 this . updateState ( this . _states , action . transaction , action . recordRef ) ;
0 commit comments