@@ -1309,7 +1309,7 @@ namespace ts {
13091309 }
13101310
13111311 function getDeclarationDiagnosticsForFile ( sourceFile : SourceFile , cancellationToken : CancellationToken ) : Diagnostic [ ] {
1312- return isDeclarationFile ( sourceFile ) ? [ ] : getDeclarationDiagnosticsWorker ( sourceFile , cancellationToken ) ;
1312+ return sourceFile . isDeclarationFile ? [ ] : getDeclarationDiagnosticsWorker ( sourceFile , cancellationToken ) ;
13131313 }
13141314
13151315 function getOptionsDiagnostics ( ) : Diagnostic [ ] {
@@ -1348,7 +1348,6 @@ namespace ts {
13481348
13491349 const isJavaScriptFile = isSourceFileJavaScript ( file ) ;
13501350 const isExternalModuleFile = isExternalModule ( file ) ;
1351- const isDtsFile = isDeclarationFile ( file ) ;
13521351
13531352 let imports : LiteralExpression [ ] ;
13541353 let moduleAugmentations : LiteralExpression [ ] ;
@@ -1401,7 +1400,7 @@ namespace ts {
14011400 }
14021401 break ;
14031402 case SyntaxKind . ModuleDeclaration :
1404- if ( isAmbientModule ( < ModuleDeclaration > node ) && ( inAmbientModule || hasModifier ( node , ModifierFlags . Ambient ) || isDeclarationFile ( file ) ) ) {
1403+ if ( isAmbientModule ( < ModuleDeclaration > node ) && ( inAmbientModule || hasModifier ( node , ModifierFlags . Ambient ) || file . isDeclarationFile ) ) {
14051404 const moduleName = < LiteralExpression > ( < ModuleDeclaration > node ) . name ;
14061405 // Ambient module declarations can be interpreted as augmentations for some existing external modules.
14071406 // This will happen in two cases:
@@ -1412,7 +1411,7 @@ namespace ts {
14121411 ( moduleAugmentations || ( moduleAugmentations = [ ] ) ) . push ( moduleName ) ;
14131412 }
14141413 else if ( ! inAmbientModule ) {
1415- if ( isDtsFile ) {
1414+ if ( file . isDeclarationFile ) {
14161415 // for global .d.ts files record name of ambient module
14171416 ( ambientModules || ( ambientModules = [ ] ) ) . push ( moduleName . text ) ;
14181417 }
@@ -1730,7 +1729,7 @@ namespace ts {
17301729 const absoluteRootDirectoryPath = host . getCanonicalFileName ( getNormalizedAbsolutePath ( rootDirectory , currentDirectory ) ) ;
17311730
17321731 for ( const sourceFile of sourceFiles ) {
1733- if ( ! isDeclarationFile ( sourceFile ) ) {
1732+ if ( ! sourceFile . isDeclarationFile ) {
17341733 const absoluteSourceFilePath = host . getCanonicalFileName ( getNormalizedAbsolutePath ( sourceFile . fileName , currentDirectory ) ) ;
17351734 if ( absoluteSourceFilePath . indexOf ( absoluteRootDirectoryPath ) !== 0 ) {
17361735 programDiagnostics . add ( createCompilerDiagnostic ( Diagnostics . File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files , sourceFile . fileName , options . rootDir ) ) ;
@@ -1843,13 +1842,13 @@ namespace ts {
18431842 const languageVersion = options . target || ScriptTarget . ES3 ;
18441843 const outFile = options . outFile || options . out ;
18451844
1846- const firstNonAmbientExternalModuleSourceFile = forEach ( files , f => isExternalModule ( f ) && ! isDeclarationFile ( f ) ? f : undefined ) ;
1845+ const firstNonAmbientExternalModuleSourceFile = forEach ( files , f => isExternalModule ( f ) && ! f . isDeclarationFile ? f : undefined ) ;
18471846 if ( options . isolatedModules ) {
18481847 if ( options . module === ModuleKind . None && languageVersion < ScriptTarget . ES2015 ) {
18491848 programDiagnostics . add ( createCompilerDiagnostic ( Diagnostics . Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher ) ) ;
18501849 }
18511850
1852- const firstNonExternalModuleSourceFile = forEach ( files , f => ! isExternalModule ( f ) && ! isDeclarationFile ( f ) ? f : undefined ) ;
1851+ const firstNonExternalModuleSourceFile = forEach ( files , f => ! isExternalModule ( f ) && ! f . isDeclarationFile ? f : undefined ) ;
18531852 if ( firstNonExternalModuleSourceFile ) {
18541853 const span = getErrorSpanForNode ( firstNonExternalModuleSourceFile , firstNonExternalModuleSourceFile ) ;
18551854 programDiagnostics . add ( createFileDiagnostic ( firstNonExternalModuleSourceFile , span . start , span . length , Diagnostics . Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided ) ) ;
0 commit comments