@@ -22,7 +22,7 @@ namespace ts.server {
22
22
23
23
export interface ConfigFileDiagEvent {
24
24
eventName : typeof ConfigFileDiagEvent ;
25
- data : { triggerFile : string , configFileName : string , diagnostics : Diagnostic [ ] } ;
25
+ data : { triggerFile : string , configFileName : string , diagnostics : ReadonlyArray < Diagnostic > } ;
26
26
}
27
27
28
28
export interface ProjectLanguageServiceStateEvent {
@@ -200,7 +200,7 @@ namespace ts.server {
200
200
/**
201
201
* This helper function processes a list of projects and return the concatenated, sortd and deduplicated output of processing each project.
202
202
*/
203
- export function combineProjectOutput < T > ( projects : Project [ ] , action : ( project : Project ) => T [ ] , comparer ?: ( a : T , b : T ) => number , areEqual ?: ( a : T , b : T ) => boolean ) {
203
+ export function combineProjectOutput < T > ( projects : ReadonlyArray < Project > , action : ( project : Project ) => ReadonlyArray < T > , comparer ?: ( a : T , b : T ) => number , areEqual ?: ( a : T , b : T ) => boolean ) {
204
204
const result = flatMap ( projects , action ) . sort ( comparer ) ;
205
205
return projects . length > 1 ? deduplicate ( result , areEqual ) : result ;
206
206
}
@@ -220,14 +220,14 @@ namespace ts.server {
220
220
221
221
interface OpenConfigFileResult {
222
222
success : boolean ;
223
- errors ?: Diagnostic [ ] ;
223
+ errors ?: ReadonlyArray < Diagnostic > ;
224
224
225
225
project ?: ConfiguredProject ;
226
226
}
227
227
228
228
export interface OpenConfiguredProjectResult {
229
229
configFileName ?: NormalizedPath ;
230
- configFileErrors ?: Diagnostic [ ] ;
230
+ configFileErrors ?: ReadonlyArray < Diagnostic > ;
231
231
}
232
232
233
233
interface FilePropertyReader < T > {
@@ -1100,18 +1100,18 @@ namespace ts.server {
1100
1100
}
1101
1101
}
1102
1102
1103
- private reportConfigFileDiagnostics ( configFileName : string , diagnostics : Diagnostic [ ] , triggerFile : string ) {
1103
+ private reportConfigFileDiagnostics ( configFileName : string , diagnostics : ReadonlyArray < Diagnostic > , triggerFile : string ) {
1104
1104
if ( ! this . eventHandler ) {
1105
1105
return ;
1106
1106
}
1107
1107
1108
1108
this . eventHandler ( < ConfigFileDiagEvent > {
1109
1109
eventName : ConfigFileDiagEvent ,
1110
- data : { configFileName, diagnostics : diagnostics || [ ] , triggerFile }
1110
+ data : { configFileName, diagnostics : diagnostics || emptyArray , triggerFile }
1111
1111
} ) ;
1112
1112
}
1113
1113
1114
- private createAndAddConfiguredProject ( configFileName : NormalizedPath , projectOptions : ProjectOptions , configFileErrors : Diagnostic [ ] , clientFileName ?: string ) {
1114
+ private createAndAddConfiguredProject ( configFileName : NormalizedPath , projectOptions : ProjectOptions , configFileErrors : ReadonlyArray < Diagnostic > , clientFileName ?: string ) {
1115
1115
const sizeLimitExceeded = this . exceededTotalSizeLimitForNonTsFiles ( configFileName , projectOptions . compilerOptions , projectOptions . files , fileNamePropertyReader ) ;
1116
1116
const project = new ConfiguredProject (
1117
1117
configFileName ,
@@ -1143,7 +1143,7 @@ namespace ts.server {
1143
1143
}
1144
1144
}
1145
1145
1146
- private addFilesToProjectAndUpdateGraph < T > ( project : ConfiguredProject | ExternalProject , files : T [ ] , propertyReader : FilePropertyReader < T > , clientFileName : string , typeAcquisition : TypeAcquisition , configFileErrors : Diagnostic [ ] ) : void {
1146
+ private addFilesToProjectAndUpdateGraph < T > ( project : ConfiguredProject | ExternalProject , files : T [ ] , propertyReader : FilePropertyReader < T > , clientFileName : string , typeAcquisition : TypeAcquisition , configFileErrors : ReadonlyArray < Diagnostic > ) : void {
1147
1147
let errors : Diagnostic [ ] ;
1148
1148
for ( const f of files ) {
1149
1149
const rootFilename = propertyReader . getFileName ( f ) ;
@@ -1456,7 +1456,7 @@ namespace ts.server {
1456
1456
1457
1457
openClientFileWithNormalizedPath ( fileName : NormalizedPath , fileContent ?: string , scriptKind ?: ScriptKind , hasMixedContent ?: boolean , projectRootPath ?: NormalizedPath ) : OpenConfiguredProjectResult {
1458
1458
let configFileName : NormalizedPath ;
1459
- let configFileErrors : Diagnostic [ ] ;
1459
+ let configFileErrors : ReadonlyArray < Diagnostic > ;
1460
1460
1461
1461
let project : ConfiguredProject | ExternalProject = this . findContainingExternalProject ( fileName ) ;
1462
1462
if ( ! project ) {
0 commit comments