diff --git a/spec-dtslint/operators/endWith-spec.ts b/spec-dtslint/operators/endWith-spec.ts
index cc3a7e9931..ae1acdbdf0 100644
--- a/spec-dtslint/operators/endWith-spec.ts
+++ b/spec-dtslint/operators/endWith-spec.ts
@@ -1,11 +1,7 @@
-import { of, asyncScheduler } from 'rxjs';
+import { of } from 'rxjs';
import { endWith } from 'rxjs/operators';
import { A, B, a, b, c, d, e, f, g, h } from '../helpers';
-it('should support a scheduler', () => {
- const r = of(a).pipe(endWith(asyncScheduler)); // $ExpectType Observable
-});
-
it('should infer type for N values', () => {
const r0 = of(a).pipe(endWith()); // $ExpectType Observable
const r1 = of(a).pipe(endWith(b)); // $ExpectType Observable
diff --git a/spec/operators/endWith-spec.ts b/spec/operators/endWith-spec.ts
index 439c39691d..e259779217 100644
--- a/spec/operators/endWith-spec.ts
+++ b/spec/operators/endWith-spec.ts
@@ -178,28 +178,6 @@ describe('endWith', () => {
});
});
- it('should accept scheduler as last argument with single value', () => {
- testScheduler.run(({ hot, expectObservable, expectSubscriptions }) => {
- const e1 = hot(' --a--| ');
- const e1subs = ' ^----! ';
- const expected = '--a--(x|)';
-
- expectObservable(e1.pipe(endWith(defaultEndValue, testScheduler))).toBe(expected);
- expectSubscriptions(e1.subscriptions).toBe(e1subs);
- });
- });
-
- it('should accept scheduler as last argument with multiple value', () => {
- testScheduler.run(({ hot, expectObservable, expectSubscriptions }) => {
- const e1 = hot(' -----a--| ');
- const e1subs = ' ^-------! ';
- const expected = '-----a--(yz|)';
-
- expectObservable(e1.pipe(endWith('y', 'z', testScheduler))).toBe(expected);
- expectSubscriptions(e1.subscriptions).toBe(e1subs);
- });
- });
-
it('should stop listening to a synchronous observable when unsubscribed', () => {
const sideEffects: number[] = [];
const synchronousObservable = new Observable((subscriber) => {
diff --git a/src/internal/operators/endWith.ts b/src/internal/operators/endWith.ts
index 436e5b301a..df937ef6db 100644
--- a/src/internal/operators/endWith.ts
+++ b/src/internal/operators/endWith.ts
@@ -1,25 +1,13 @@
/** prettier */
-import { Observable } from '../Observable';
-import { concat } from '../observable/concat';
-import { of } from '../observable/of';
-import { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ValueFromArray } from '../types';
-
-/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
-export function endWith(scheduler: SchedulerLike): MonoTypeOperatorFunction;
-/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */
-export function endWith(
- ...valuesAndScheduler: [...A, SchedulerLike]
-): OperatorFunction>;
-
-export function endWith(...values: A): OperatorFunction>;
+import { fromArrayLike } from '../observable/innerFrom';
+import { OperatorFunction, ValueFromArray } from '../types';
+import { operate } from '../util/lift';
+import { concatAll } from './concatAll';
/**
* Returns an observable that will emit all values from the source, then synchronously emit
* the provided value(s) immediately after the source completes.
*
- * NOTE: Passing a last argument of a Scheduler is _deprecated_, and may result in incorrect
- * types in TypeScript.
- *
* This is useful for knowing when an observable ends. Particularly when paired with an
* operator like {@link takeUntil}
*
@@ -63,6 +51,8 @@ export function endWith(...values: A): OperatorFun
* source, then synchronously emits the provided value(s) immediately after the
* source completes.
*/
-export function endWith(...values: Array): MonoTypeOperatorFunction {
- return (source: Observable) => concat(source, of(...values)) as Observable;
+export function endWith(...values: A): OperatorFunction> {
+ return operate((source, subscriber) => {
+ concatAll()(fromArrayLike([source, fromArrayLike(values)])).subscribe(subscriber);
+ });
}