@@ -9,7 +9,7 @@ import { FileDoesNotExistException, Path, getSystemPath, normalize } from '@angu
9
9
import { Stats } from 'fs' ;
10
10
import { InputFileSystem } from 'webpack' ;
11
11
import { WebpackCompilerHost } from './compiler_host' ;
12
- import { Callback , NodeWatchFileSystemInterface } from './webpack' ;
12
+ import { NodeWatchFileSystemInterface } from './webpack' ;
13
13
14
14
export const NodeWatchFileSystem : NodeWatchFileSystemInterface = require (
15
15
'webpack/lib/node/NodeWatchFileSystem' ) ;
@@ -29,7 +29,7 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
29
29
return this . _webpackCompilerHost . getNgFactoryPaths ( ) ;
30
30
}
31
31
32
- stat ( path : string , callback : ( err : Error , stats : Stats ) => void ) : void {
32
+ stat ( path : string , callback : ( err : Error , result : Stats ) => void ) : void {
33
33
const result = this . _webpackCompilerHost . stat ( path ) ;
34
34
if ( result ) {
35
35
// tslint:disable-next-line:no-any
@@ -40,8 +40,8 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
40
40
}
41
41
}
42
42
43
- readdir ( path : string , callback : Callback < string [ ] > ) : void {
44
- // tslint:disable-next-line:no-any
43
+ readdir ( path : string , callback : ( err : Error , result : string [ ] ) => void ) : void {
44
+ // tslint:disable-next-line: no-any
45
45
( this . _inputFileSystem as any ) . readdir ( path , callback ) ;
46
46
}
47
47
@@ -55,7 +55,7 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
55
55
}
56
56
}
57
57
58
- readJson ( path : string , callback : Callback < { } > ) : void {
58
+ readJson ( path : string , callback : ( err : Error , result : unknown ) => void ) : void {
59
59
// tslint:disable-next-line:no-any
60
60
( this . _inputFileSystem as any ) . readJson ( path , callback ) ;
61
61
}
@@ -112,17 +112,17 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
112
112
super ( _virtualInputFileSystem ) ;
113
113
}
114
114
115
- watch (
116
- files : string [ ] ,
117
- dirs : string [ ] ,
118
- missing : string [ ] ,
119
- startTime : number | undefined ,
115
+ watch = (
116
+ files : Iterable < string > ,
117
+ dirs : Iterable < string > ,
118
+ missing : Iterable < string > ,
119
+ startTime : number ,
120
120
options : { } ,
121
- callback : any , // tslint:disable-line:no-any
121
+ callback : Parameters < NodeWatchFileSystemInterface [ 'watch' ] > [ 5 ] ,
122
122
callbackUndelayed : ( filename : string , timestamp : number ) => void ,
123
- ) {
123
+ ) : ReturnType < NodeWatchFileSystemInterface [ 'watch' ] > => {
124
124
const reverseReplacements = new Map < string , string > ( ) ;
125
- const reverseTimestamps = ( map : Map < string , number > ) => {
125
+ const reverseTimestamps = < T > ( map : Map < string , T > ) => {
126
126
for ( const entry of Array . from ( map . entries ( ) ) ) {
127
127
const original = reverseReplacements . get ( entry [ 0 ] ) ;
128
128
if ( original ) {
@@ -144,7 +144,7 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
144
144
}
145
145
} ;
146
146
147
- const newCallback = (
147
+ const newCallback : Parameters < NodeWatchFileSystemInterface [ 'watch' ] > [ 5 ] = (
148
148
err : Error | null ,
149
149
filesModified : string [ ] ,
150
150
contextModified : string [ ] ,
@@ -169,13 +169,13 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
169
169
) ;
170
170
} ;
171
171
172
- const mapReplacements = ( original : string [ ] ) : string [ ] => {
172
+ const mapReplacements = ( original : Iterable < string > ) : Iterable < string > => {
173
173
if ( ! this . _replacements ) {
174
174
return original ;
175
175
}
176
176
const replacements = this . _replacements ;
177
177
178
- return original . map ( file => {
178
+ return [ ... original ] . map ( file => {
179
179
if ( typeof replacements === 'function' ) {
180
180
const replacement = getSystemPath ( replacements ( normalize ( file ) ) ) ;
181
181
if ( replacement !== file ) {
0 commit comments