@@ -9,7 +9,7 @@ import { FileDoesNotExistException, Path, getSystemPath, normalize } from '@angu
99import { Stats } from 'fs' ;
1010import { InputFileSystem } from 'webpack' ;
1111import { WebpackCompilerHost } from './compiler_host' ;
12- import { Callback , NodeWatchFileSystemInterface } from './webpack' ;
12+ import { NodeWatchFileSystemInterface } from './webpack' ;
1313
1414export const NodeWatchFileSystem : NodeWatchFileSystemInterface = require (
1515 'webpack/lib/node/NodeWatchFileSystem' ) ;
@@ -29,7 +29,7 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
2929 return this . _webpackCompilerHost . getNgFactoryPaths ( ) ;
3030 }
3131
32- stat ( path : string , callback : ( err : Error , stats : Stats ) => void ) : void {
32+ stat ( path : string , callback : ( err : Error , result : Stats ) => void ) : void {
3333 const result = this . _webpackCompilerHost . stat ( path ) ;
3434 if ( result ) {
3535 // tslint:disable-next-line:no-any
@@ -40,8 +40,8 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
4040 }
4141 }
4242
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
4545 ( this . _inputFileSystem as any ) . readdir ( path , callback ) ;
4646 }
4747
@@ -55,7 +55,7 @@ export class VirtualFileSystemDecorator implements InputFileSystem {
5555 }
5656 }
5757
58- readJson ( path : string , callback : Callback < { } > ) : void {
58+ readJson ( path : string , callback : ( err : Error , result : unknown ) => void ) : void {
5959 // tslint:disable-next-line:no-any
6060 ( this . _inputFileSystem as any ) . readJson ( path , callback ) ;
6161 }
@@ -112,17 +112,17 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
112112 super ( _virtualInputFileSystem ) ;
113113 }
114114
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 ,
120120 options : { } ,
121- callback : any , // tslint:disable-line:no-any
121+ callback : Parameters < NodeWatchFileSystemInterface [ 'watch' ] > [ 5 ] ,
122122 callbackUndelayed : ( filename : string , timestamp : number ) => void ,
123- ) {
123+ ) : ReturnType < NodeWatchFileSystemInterface [ 'watch' ] > => {
124124 const reverseReplacements = new Map < string , string > ( ) ;
125- const reverseTimestamps = ( map : Map < string , number > ) => {
125+ const reverseTimestamps = < T > ( map : Map < string , T > ) => {
126126 for ( const entry of Array . from ( map . entries ( ) ) ) {
127127 const original = reverseReplacements . get ( entry [ 0 ] ) ;
128128 if ( original ) {
@@ -144,7 +144,7 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
144144 }
145145 } ;
146146
147- const newCallback = (
147+ const newCallback : Parameters < NodeWatchFileSystemInterface [ 'watch' ] > [ 5 ] = (
148148 err : Error | null ,
149149 filesModified : string [ ] ,
150150 contextModified : string [ ] ,
@@ -169,13 +169,13 @@ export class VirtualWatchFileSystemDecorator extends NodeWatchFileSystem {
169169 ) ;
170170 } ;
171171
172- const mapReplacements = ( original : string [ ] ) : string [ ] => {
172+ const mapReplacements = ( original : Iterable < string > ) : Iterable < string > => {
173173 if ( ! this . _replacements ) {
174174 return original ;
175175 }
176176 const replacements = this . _replacements ;
177177
178- return original . map ( file => {
178+ return [ ... original ] . map ( file => {
179179 if ( typeof replacements === 'function' ) {
180180 const replacement = getSystemPath ( replacements ( normalize ( file ) ) ) ;
181181 if ( replacement !== file ) {
0 commit comments