@@ -56,7 +56,7 @@ export class AotPlugin implements Tapable {
5656 private _tsConfigPath : string ;
5757 private _entryModule : string ;
5858
59- private _donePromise : Promise < void > ;
59+ private _donePromise : Promise < void > | null ;
6060 private _compiler : any = null ;
6161 private _compilation : any = null ;
6262
@@ -66,10 +66,10 @@ export class AotPlugin implements Tapable {
6666 private _basePath : string ;
6767 private _genDir : string ;
6868
69- private _i18nFile : string ;
70- private _i18nFormat : string ;
71- private _locale : string ;
72- private _missingTranslation : string ;
69+ private _i18nFile ? : string ;
70+ private _i18nFormat ? : string ;
71+ private _locale ? : string ;
72+ private _missingTranslation ? : string ;
7373
7474 private _diagnoseFiles : { [ path : string ] : boolean } = { } ;
7575 private _firstRun = true ;
@@ -128,7 +128,7 @@ export class AotPlugin implements Tapable {
128128 const message = ts . flattenDiagnosticMessageText ( diagnostic . messageText , '\n' ) ;
129129
130130 if ( diagnostic . file ) {
131- const { line, character} = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ) ;
131+ const { line, character} = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ! ) ;
132132 throw new Error ( `${ diagnostic . file . fileName } (${ line + 1 } ,${ character + 1 } ): ${ message } )` ) ;
133133 } else {
134134 throw new Error ( message ) ;
@@ -166,7 +166,7 @@ export class AotPlugin implements Tapable {
166166 }
167167
168168 const tsConfig = ts . parseJsonConfigFileContent (
169- tsConfigJson , ts . sys , basePath , null , this . _tsConfigPath ) ;
169+ tsConfigJson , ts . sys , basePath , undefined , this . _tsConfigPath ) ;
170170
171171 let fileNames = tsConfig . fileNames ;
172172 this . _rootFilePath = fileNames ;
@@ -192,23 +192,23 @@ export class AotPlugin implements Tapable {
192192 this . _basePath = basePath ;
193193 this . _genDir = genDir ;
194194
195- if ( options . hasOwnProperty ( ' typeChecking' ) ) {
195+ if ( options . typeChecking !== undefined ) {
196196 this . _typeCheck = options . typeChecking ;
197197 }
198- if ( options . hasOwnProperty ( ' skipCodeGeneration' ) ) {
198+ if ( options . skipCodeGeneration !== undefined ) {
199199 this . _skipCodeGeneration = options . skipCodeGeneration ;
200200 }
201201
202202 this . _compilerHost = new WebpackCompilerHost ( this . _compilerOptions , this . _basePath ) ;
203203
204204 // Override some files in the FileSystem.
205- if ( options . hasOwnProperty ( ' hostOverrideFileSystem' ) ) {
205+ if ( options . hostOverrideFileSystem ) {
206206 for ( const filePath of Object . keys ( options . hostOverrideFileSystem ) ) {
207207 this . _compilerHost . writeFile ( filePath , options . hostOverrideFileSystem [ filePath ] , false ) ;
208208 }
209209 }
210210 // Override some files in the FileSystem with paths from the actual file system.
211- if ( options . hasOwnProperty ( ' hostReplacementPaths' ) ) {
211+ if ( options . hostReplacementPaths ) {
212212 for ( const filePath of Object . keys ( options . hostReplacementPaths ) ) {
213213 const replacementFilePath = options . hostReplacementPaths [ filePath ] ;
214214 const content = this . _compilerHost . readFile ( replacementFilePath ) ;
@@ -345,7 +345,7 @@ export class AotPlugin implements Tapable {
345345 return callback ( null , result ) ;
346346 }
347347
348- this . done . then ( ( ) => {
348+ this . done ! . then ( ( ) => {
349349 result . resource = this . genDir ;
350350 result . dependencies . forEach ( ( d : any ) => d . critical = false ) ;
351351 result . resolveDependencies = ( _fs : any , _resource : any , _recursive : any ,
@@ -380,7 +380,7 @@ export class AotPlugin implements Tapable {
380380 // Virtual file system.
381381 compiler . resolvers . normal . plugin ( 'before-resolve' , ( request : any , cb : ( ) => void ) => {
382382 if ( request . request . match ( / \. t s $ / ) ) {
383- this . done . then ( ( ) => cb ( ) , ( ) => cb ( ) ) ;
383+ this . done ! . then ( ( ) => cb ( ) , ( ) => cb ( ) ) ;
384384 } else {
385385 cb ( ) ;
386386 }
@@ -432,21 +432,20 @@ export class AotPlugin implements Tapable {
432432 return ;
433433 }
434434
435- const diagnostics : ts . Diagnostic [ ] = [ ]
436- . concat (
437- this . _program . getCompilerOptions ( ) . declaration
438- ? this . _program . getDeclarationDiagnostics ( sourceFile ) : [ ] ,
439- this . _program . getSyntacticDiagnostics ( sourceFile ) ,
440- this . _program . getSemanticDiagnostics ( sourceFile )
441- ) ;
435+ const diagnostics : Array < ts . Diagnostic > = [
436+ ...( this . _program . getCompilerOptions ( ) . declaration
437+ ? this . _program . getDeclarationDiagnostics ( sourceFile ) : [ ] ) ,
438+ ...this . _program . getSyntacticDiagnostics ( sourceFile ) ,
439+ ...this . _program . getSemanticDiagnostics ( sourceFile )
440+ ] ;
442441
443442 if ( diagnostics . length > 0 ) {
444443 diagnostics . forEach ( diagnostic => {
445444 const messageText = ts . flattenDiagnosticMessageText ( diagnostic . messageText , '\n' ) ;
446445 let message ;
447446
448447 if ( diagnostic . file ) {
449- const position = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ) ;
448+ const position = diagnostic . file . getLineAndCharacterOfPosition ( diagnostic . start ! ) ;
450449
451450 const sourceText = diagnostic . file . getFullText ( ) ;
452451 let { line, character, fileName} = this . _translateSourceMap ( sourceText ,
@@ -532,7 +531,7 @@ export class AotPlugin implements Tapable {
532531
533532 if ( diagnostic . file ) {
534533 const { line, character} = diagnostic . file . getLineAndCharacterOfPosition (
535- diagnostic . start ) ;
534+ diagnostic . start ! ) ;
536535 return `${ diagnostic . file . fileName } (${ line + 1 } ,${ character + 1 } ): ${ message } )` ;
537536 } else {
538537 return message ;
0 commit comments