Skip to content

Commit cfc6d35

Browse files
Merge pull request #26589 from Microsoft/deduplicate_overloads
Remove unused overloads of 'deduplicate' and 'deduplicateSorted'
2 parents 54f7666 + 213d374 commit cfc6d35

File tree

2 files changed

+4
-15
lines changed

2 files changed

+4
-15
lines changed

src/compiler/core.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,8 @@ namespace ts {
789789
* @param comparer An optional `Comparer` used to sort entries before comparison, though the
790790
* result will remain in the original order in `array`.
791791
*/
792-
export function deduplicate<T>(array: ReadonlyArray<T>, equalityComparer?: EqualityComparer<T>, comparer?: Comparer<T>): T[];
793-
export function deduplicate<T>(array: ReadonlyArray<T> | undefined, equalityComparer?: EqualityComparer<T>, comparer?: Comparer<T>): T[] | undefined;
794-
export function deduplicate<T>(array: ReadonlyArray<T> | undefined, equalityComparer: EqualityComparer<T>, comparer?: Comparer<T>): T[] | undefined {
795-
return !array ? undefined :
796-
array.length === 0 ? [] :
792+
export function deduplicate<T>(array: ReadonlyArray<T>, equalityComparer: EqualityComparer<T>, comparer?: Comparer<T>): T[] {
793+
return array.length === 0 ? [] :
797794
array.length === 1 ? array.slice() :
798795
comparer ? deduplicateRelational(array, equalityComparer, comparer) :
799796
deduplicateEquality(array, equalityComparer);
@@ -802,10 +799,7 @@ namespace ts {
802799
/**
803800
* Deduplicates an array that has already been sorted.
804801
*/
805-
function deduplicateSorted<T>(array: ReadonlyArray<T>, comparer: EqualityComparer<T> | Comparer<T>): T[];
806-
function deduplicateSorted<T>(array: ReadonlyArray<T> | undefined, comparer: EqualityComparer<T> | Comparer<T>): T[] | undefined;
807-
function deduplicateSorted<T>(array: ReadonlyArray<T> | undefined, comparer: EqualityComparer<T> | Comparer<T>): T[] | undefined {
808-
if (!array) return undefined;
802+
function deduplicateSorted<T>(array: ReadonlyArray<T>, comparer: EqualityComparer<T> | Comparer<T>): T[] {
809803
if (array.length === 0) return [];
810804

811805
let last = array[0];

src/server/session.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,6 @@ namespace ts.server {
266266
getValue: (path: Path) => T,
267267
projects: Projects,
268268
action: (project: Project, value: T) => ReadonlyArray<U> | U | undefined,
269-
comparer?: (a: U, b: U) => number,
270-
areEqual?: (a: U, b: U) => boolean,
271269
): U[] {
272270
const outputs = flatMap(isArray(projects) ? projects : projects.projects, project => action(project, defaultValue));
273271
if (!isArray(projects) && projects.symLinkedProjects) {
@@ -276,10 +274,7 @@ namespace ts.server {
276274
outputs.push(...flatMap(projects, project => action(project, value)));
277275
});
278276
}
279-
280-
return comparer
281-
? sortAndDeduplicate(outputs, comparer, areEqual)
282-
: deduplicate(outputs, areEqual);
277+
return deduplicate(outputs, equateValues);
283278
}
284279

285280
function combineProjectOutputFromEveryProject<T>(projectService: ProjectService, action: (project: Project) => ReadonlyArray<T>, areEqual: (a: T, b: T) => boolean) {

0 commit comments

Comments
 (0)