Skip to content

Commit b9bb745

Browse files
authored
Merge pull request microsoft#21352 from Microsoft/emitApiDiagnostics
Expose sort and deduplicate diagnostics in Public API
2 parents 0b7f6d5 + a05f669 commit b9bb745

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 */
@@ -1901,10 +1905,6 @@ namespace ts {
19011905
return text1 ? Comparison.GreaterThan : Comparison.LessThan;
19021906
}
19031907

1904-
export function sortAndDeduplicateDiagnostics(diagnostics: ReadonlyArray<Diagnostic>): Diagnostic[] {
1905-
return sortAndDeduplicate(diagnostics, compareDiagnostics);
1906-
}
1907-
19081908
export function normalizeSlashes(path: string): string {
19091909
return path.replace(/\\/g, "/");
19101910
}

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)