diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 73c92eff547..834f451df80 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -1415,7 +1415,7 @@ namespace ts { } /** Remove the *first* element satisfying `predicate`. */ - export function unorderedRemoveFirstItemWhere(array: T[], predicate: (element: T) => boolean): void { + function unorderedRemoveFirstItemWhere(array: T[], predicate: (element: T) => boolean): void { for (let i = 0; i < array.length; i++) { if (predicate(array[i])) { unorderedRemoveItemAt(array, i); diff --git a/src/harness/unittests/tsserverProjectSystem.ts b/src/harness/unittests/tsserverProjectSystem.ts index b02e4d81cd3..0c491ad349e 100644 --- a/src/harness/unittests/tsserverProjectSystem.ts +++ b/src/harness/unittests/tsserverProjectSystem.ts @@ -209,12 +209,13 @@ namespace ts { watchDirectory(directoryName: string, callback: DirectoryWatcherCallback, recursive: boolean): DirectoryWatcher { const path = this.toPath(directoryName); const callbacks = lookUp(this.watchedDirectories, path) || (this.watchedDirectories[path] = []); - callbacks.push({ cb: callback, recursive }); + const cbWithRecursive = { cb: callback, recursive }; + callbacks.push(cbWithRecursive); return { referenceCount: 0, directoryName, close: () => { - unorderedRemoveFirstItemWhere(callbacks, cb => cb.cb === callback); + unorderedRemoveItem(cbWithRecursive, callbacks); if (!callbacks.length) { delete this.watchedDirectories[path]; }