Skip to content

Commit a05f669

Browse files
committed
Expose sort and deduplicate diagnostics in Public API
Fixes microsoft#20876
1 parent a3387cc commit a05f669

3 files changed

Lines changed: 6 additions & 4 deletions

File tree

src/compiler/core.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ namespace ts {
1616
// Update: We also consider a path like `C:\foo.ts` "relative" because we do not search for it in `node_modules` or treat it as an ambient module.
1717
return pathIsRelative(moduleName) || isRootedDiskPath(moduleName);
1818
}
19+
20+
export function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[] {
21+
return sortAndDeduplicate(diagnostics, compareDiagnostics);
22+
}
1923
}
2024

2125
/* @internal */
@@ -1897,10 +1901,6 @@ namespace ts {
18971901
return text1 ? Comparison.GreaterThan : Comparison.LessThan;
18981902
}
18991903

1900-
export function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[] {
1901-
return sortAndDeduplicate(diagnostics, compareDiagnostics);
1902-
}
1903-
19041904
export function normalizeSlashes(path: string): string {
19051905
return path.replace(/\\/g, "/");
19061906
}

tests/baselines/reference/api/tsserverlibrary.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,7 @@ declare namespace ts {
28142814
}
28152815
declare namespace ts {
28162816
function isExternalModuleNameRelative(moduleName: string): boolean;
2817+
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
28172818
}
28182819
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
28192820
declare function clearTimeout(handle: any): void;

tests/baselines/reference/api/typescript.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2814,6 +2814,7 @@ declare namespace ts {
28142814
}
28152815
declare namespace ts {
28162816
function isExternalModuleNameRelative(moduleName: string): boolean;
2817+
function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[];
28172818
}
28182819
declare function setTimeout(handler: (...args: any[]) => void, timeout: number): any;
28192820
declare function clearTimeout(handle: any): void;

0 commit comments

Comments
 (0)