Skip to content

Commit

Permalink
feat(concat): removed deprecated concat operator (#7162)
Browse files Browse the repository at this point in the history
* feat(concat): removed deprecated `concat` operator

BREAKING CHANGE: The `concat` operator is no longer available. Use `concatWith`.

* refactor(concatWith): Use `innerFrom` instead of `from`.

Co-authored-by: Ben Lesh <ben@benlesh.com>
  • Loading branch information
demensky and benlesh authored Jan 21, 2023
1 parent d6bf2cb commit 3807dae
Show file tree
Hide file tree
Showing 13 changed files with 20 additions and 464 deletions.
63 changes: 0 additions & 63 deletions spec-dtslint/operators/concat-spec.ts

This file was deleted.

6 changes: 3 additions & 3 deletions spec/Observable-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from 'chai';
import * as sinon from 'sinon';
import { TeardownLogic } from '../src/internal/types';
import { Observable, config, Subscription, Subscriber, Operator, NEVER, Subject, of, throwError, EMPTY } from 'rxjs';
import { map, multicast, refCount, filter, count, tap, combineLatestWith, concat, merge, race, zip, catchError, publish, publishLast, publishBehavior, share} from 'rxjs/operators';
import { map, multicast, refCount, filter, count, tap, combineLatestWith, concatWith, merge, race, zip, catchError, publish, publishLast, publishBehavior, share} from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { observableMatcher } from './helpers/observableMatcher';

Expand Down Expand Up @@ -1077,13 +1077,13 @@ describe('Observable.lift', () => {
});
});

it('should compose through concat', () => {
it('should compose through concatWith', () => {
rxTestScheduler.run(({ cold, expectObservable }) => {
const e1 = cold(' --a--b-|');
const e2 = cold(' --x---y--|');
const expected = '--a--b---x---y--|';

const result = MyCustomObservable.from(e1).pipe(concat(e2, rxTestScheduler));
const result = MyCustomObservable.from(e1).pipe(concatWith(e2));

expect(result instanceof MyCustomObservable).to.be.true;

Expand Down
4 changes: 2 additions & 2 deletions spec/observables/fromEvent-spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/** @prettier */
import { expect } from 'chai';
import { fromEvent, NEVER, timer } from 'rxjs';
import { mapTo, take, concat } from 'rxjs/operators';
import { mapTo, take, concatWith } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { observableMatcher } from '../helpers/observableMatcher';

Expand All @@ -21,7 +21,7 @@ describe('fromEvent', () => {

const target = {
addEventListener: (eventType: any, listener: any) => {
timer(delay1, delay2).pipe(mapTo('ev'), take(2), concat(NEVER)).subscribe(listener);
timer(delay1, delay2).pipe(mapTo('ev'), take(2), concatWith(NEVER)).subscribe(listener);
},
removeEventListener: (): void => void 0,
dispatchEvent: (): void => void 0,
Expand Down
4 changes: 2 additions & 2 deletions spec/observables/fromEventPattern-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { expect } from 'chai';
import * as sinon from 'sinon';

import { fromEventPattern, noop, NEVER, timer } from 'rxjs';
import { mapTo, take, concat } from 'rxjs/operators';
import { mapTo, take, concatWith } from 'rxjs/operators';
import { TestScheduler } from 'rxjs/testing';
import { observableMatcher } from '../helpers/observableMatcher';

Expand All @@ -22,7 +22,7 @@ describe('fromEventPattern', () => {
const expected = ' -----x-x---';

function addHandler(h: any) {
timer(time1, time2, rxTestScheduler).pipe(mapTo('ev'), take(2), concat(NEVER)).subscribe(h);
timer(time1, time2, rxTestScheduler).pipe(mapTo('ev'), take(2), concatWith(NEVER)).subscribe(h);
}
const e1 = fromEventPattern(addHandler);

Expand Down
2 changes: 1 addition & 1 deletion spec/observables/interval-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { expect } from 'chai';
import { NEVER, interval, asapScheduler, animationFrameScheduler, queueScheduler } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
import { take, concat } from 'rxjs/operators';
import { take } from 'rxjs/operators';
import * as sinon from 'sinon';
import { observableMatcher } from '../helpers/observableMatcher';

Expand Down
4 changes: 2 additions & 2 deletions spec/observables/timer-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { timer, NEVER, merge } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';
import { mergeMap, take, concat } from 'rxjs/operators';
import { mergeMap, take, concatWith } from 'rxjs/operators';
import { observableMatcher } from '../helpers/observableMatcher';

/** @test {timer} */
Expand All @@ -15,7 +15,7 @@ describe('timer', () => {
rxTest.run(({ expectObservable }) => {
const e1 = timer(6, 2, rxTest).pipe(
take(4), // make it actually finite, so it can be rendered
concat(NEVER) // but pretend it's infinite by not completing
concatWith(NEVER) // but pretend it's infinite by not completing
);
const expected = '------a-b-c-d-';
const values = {
Expand Down
Loading

0 comments on commit 3807dae

Please sign in to comment.