@@ -69,22 +69,16 @@ namespace ts {
69
69
if ( ! compilerOptions . noResolve ) {
70
70
let addedGlobalFileReference = false ;
71
71
forEach ( root . referencedFiles , fileReference => {
72
- if ( isJavaScript ( fileReference . fileName ) ) {
73
- reportedDeclarationError = true ;
74
- diagnostics . push ( createFileDiagnostic ( root , fileReference . pos , fileReference . end - fileReference . pos , Diagnostics . js_file_cannot_be_referenced_in_ts_file_when_emitting_declarations ) ) ;
75
- }
76
- else {
77
- let referencedFile = tryResolveScriptReference ( host , root , fileReference ) ;
72
+ let referencedFile = tryResolveScriptReference ( host , root , fileReference ) ;
78
73
79
- // All the references that are not going to be part of same file
80
- if ( referencedFile && ( ( referencedFile . flags & NodeFlags . DeclarationFile ) || // This is a declare file reference
81
- shouldEmitToOwnFile ( referencedFile , compilerOptions ) || // This is referenced file is emitting its own js file
82
- ! addedGlobalFileReference ) ) { // Or the global out file corresponding to this reference was not added
74
+ // All the references that are not going to be part of same file
75
+ if ( referencedFile && ( ( referencedFile . flags & NodeFlags . DeclarationFile ) || // This is a declare file reference
76
+ shouldEmitToOwnFile ( referencedFile , compilerOptions ) || // This is referenced file is emitting its own js file
77
+ ! addedGlobalFileReference ) ) { // Or the global out file corresponding to this reference was not added
83
78
84
- writeReferencePath ( referencedFile ) ;
85
- if ( ! isExternalModuleOrDeclarationFile ( referencedFile ) ) {
86
- addedGlobalFileReference = true ;
87
- }
79
+ writeReferencePath ( referencedFile ) ;
80
+ if ( ! isExternalModuleOrDeclarationFile ( referencedFile ) ) {
81
+ addedGlobalFileReference = true ;
88
82
}
89
83
}
90
84
} ) ;
@@ -111,24 +105,18 @@ namespace ts {
111
105
// Emit references corresponding to this file
112
106
let emittedReferencedFiles : SourceFile [ ] = [ ] ;
113
107
forEach ( host . getSourceFiles ( ) , sourceFile => {
114
- if ( ! isExternalModuleOrDeclarationFile ( sourceFile ) && ! isJavaScript ( sourceFile . fileName ) ) {
108
+ if ( ! isExternalModuleOrDeclarationFile ( sourceFile ) ) {
115
109
// Check what references need to be added
116
110
if ( ! compilerOptions . noResolve ) {
117
111
forEach ( sourceFile . referencedFiles , fileReference => {
118
- if ( isJavaScript ( fileReference . fileName ) ) {
119
- reportedDeclarationError = true ;
120
- diagnostics . push ( createFileDiagnostic ( sourceFile , fileReference . pos , fileReference . end - fileReference . pos , Diagnostics . js_file_cannot_be_referenced_in_ts_file_when_emitting_declarations ) ) ;
121
- }
122
- else {
123
- let referencedFile = tryResolveScriptReference ( host , sourceFile , fileReference ) ;
112
+ let referencedFile = tryResolveScriptReference ( host , sourceFile , fileReference ) ;
124
113
125
- // If the reference file is a declaration file or an external module, emit that reference
126
- if ( referencedFile && ( isExternalModuleOrDeclarationFile ( referencedFile ) &&
127
- ! contains ( emittedReferencedFiles , referencedFile ) ) ) { // If the file reference was not already emitted
114
+ // If the reference file is a declaration file or an external module, emit that reference
115
+ if ( referencedFile && ( isExternalModuleOrDeclarationFile ( referencedFile ) &&
116
+ ! contains ( emittedReferencedFiles , referencedFile ) ) ) { // If the file reference was not already emitted
128
117
129
- writeReferencePath ( referencedFile ) ;
130
- emittedReferencedFiles . push ( referencedFile ) ;
131
- }
118
+ writeReferencePath ( referencedFile ) ;
119
+ emittedReferencedFiles . push ( referencedFile ) ;
132
120
}
133
121
} ) ;
134
122
}
0 commit comments