@@ -27,28 +27,28 @@ let _id = 1;
27
27
export class ActionList implements Iterable < Action > {
28
28
private _actions : Action [ ] = [ ] ;
29
29
30
- protected _action ( action : Partial < Action > ) {
30
+ protected _action ( action : Partial < Action > ) : void {
31
31
this . _actions . push ( {
32
32
...( action as Action ) ,
33
33
id : _id ++ ,
34
34
parent : this . _actions [ this . _actions . length - 1 ] ?. id ?? 0 ,
35
35
} ) ;
36
36
}
37
37
38
- create ( path : Path , content : Buffer ) {
38
+ create ( path : Path , content : Buffer ) : void {
39
39
this . _action ( { kind : 'c' , path, content } ) ;
40
40
}
41
- overwrite ( path : Path , content : Buffer ) {
41
+ overwrite ( path : Path , content : Buffer ) : void {
42
42
this . _action ( { kind : 'o' , path, content } ) ;
43
43
}
44
- rename ( path : Path , to : Path ) {
44
+ rename ( path : Path , to : Path ) : void {
45
45
this . _action ( { kind : 'r' , path, to } ) ;
46
46
}
47
- delete ( path : Path ) {
47
+ delete ( path : Path ) : void {
48
48
this . _action ( { kind : 'd' , path } ) ;
49
49
}
50
50
51
- optimize ( ) {
51
+ optimize ( ) : void {
52
52
const toCreate = new Map < Path , Buffer > ( ) ;
53
53
const toRename = new Map < Path , Path > ( ) ;
54
54
const toOverwrite = new Map < Path , Buffer > ( ) ;
@@ -122,13 +122,13 @@ export class ActionList implements Iterable<Action> {
122
122
} ) ;
123
123
}
124
124
125
- push ( action : Action ) {
125
+ push ( action : Action ) : void {
126
126
this . _actions . push ( action ) ;
127
127
}
128
- get ( i : number ) {
128
+ get ( i : number ) : Action {
129
129
return this . _actions [ i ] ;
130
130
}
131
- has ( action : Action ) {
131
+ has ( action : Action ) : boolean {
132
132
for ( let i = 0 ; i < this . _actions . length ; i ++ ) {
133
133
const a = this . _actions [ i ] ;
134
134
if ( a . id == action . id ) {
@@ -144,10 +144,10 @@ export class ActionList implements Iterable<Action> {
144
144
find ( predicate : ( value : Action ) => boolean ) : Action | null {
145
145
return this . _actions . find ( predicate ) || null ;
146
146
}
147
- forEach ( fn : ( value : Action , index : number , array : Action [ ] ) => void , thisArg ?: { } ) {
147
+ forEach ( fn : ( value : Action , index : number , array : Action [ ] ) => void , thisArg ?: { } ) : void {
148
148
this . _actions . forEach ( fn , thisArg ) ;
149
149
}
150
- get length ( ) {
150
+ get length ( ) : number {
151
151
return this . _actions . length ;
152
152
}
153
153
[ Symbol . iterator ] ( ) : IterableIterator < Action > {
0 commit comments