closingNotifier now supports any ObservableInput (#7073) (61b877a)delayWhen's delayDurationSelector now supports any ObservableInput (#7049) (dfd95db)compareTo now supports any ObservableInput (#7102) (d501961)ShareConfig factory properties now supports any ObservableInput (#7093) (cc3995a)notifier now supports any ObservableInput (#7091) (60d6c40)windowBoundaries now supports any ObservableInput (#7088) (8c4347c)flush argument now supports any ObservableInput (#7081) (74c9ebd)notifier supports ObservableInput (#7103) (8f1b976)notifier now supports any ObservableInput (#7105) (794f806)notifier now supports any ObservableInput (#7104) (b18c2eb)onErrorResumeNext and exported from the top level. (onErrorResumeNext operator is stil available, but deprecated) (#6755) (51e3b2c)share and connect no longer bundle scheduling code by default (#6873) (9948dc2), closes #6872require export condition (#6821) (c8955e4)bind functions passed with observers to subscribe. (#6815) (fb375a0), closes #6783unknown rather than any, which should resolve issues with eslint no-unsafe-argument (#6738) (67cb317), closes #6536Boolean constructor. (#6633) (081ca2b)Connectable, the return type of connectable (#6531) (69f5bfa), closes #6529rxjs/operators will be deprecated soon. (#6488) (512adc2), closes #6242share, publish, publishReplay are now referentially transparent. Meaning if you take the result of calling publishReplay(3) and pass it to more than one observable's pipe method, it will behave the same in each case, rather than having a cumulative effect, which was a regression introduced sometime in version 6. If you required this broken behavior, there is a workaround posted here (#6410) (e2f2e51), closes /github.com/ReactiveX/rxjs/pull/6410#issuecomment-846087374 #5411observed property. This will allow users to check whether a subject has current subscribers without us allowing access to the observers array, which is going to be made private in future versions. (#6405) (f47425d)1. (#6359) (e797bd7)useDeprecatedSynchronousErrorHandling is true. (#6365) (e19e104), closes #6364type (AjaxResponseType) (#6279) (839e192)instanceof AjaxError. (#6275) (a7c2d29)connectable, now takes a configuration object instead of just the Subject instance. This was necessary to make sure it covered all use cases for what we were trying to replace in the deprecated multicasting operators. Apologies for the late-in-the-game change, but we know it's not widely used yet (it's new in v7), and we want to get it right.unknown is inferred for 9+ arguments. (#6212) (6fa819b)params option in the request configuration (#6174) (980f4d4)from(readableStream). (#6163) (19d6502)any will now behave property with findIndex (#6097) (c6f73d6)undefined as an argument, require an argument (4983760), closes #6064defaultValue of undefined. (5bc1b3e)defaultValue of undefined. (62a6bbe)defaultValue of undefined. (ef3e721)defaultIfEmpty requires a value be passed. Will no longer convert undefined to null for no good reason.5bc8e3361 Fix/6052 ajax responseType should default to "json" (#6056)
responseType is now properly defaulted to "json" again. (#6056) (5bc8e3361)take. (#6062) (a2b9563)any will now behave property in TS (#5987) (f5ae97d), closes #5986publish variants returning ConnectableObservable not properly utilizing lift (#6003) (9acb950)useDeprecatedSynchronousErrorThrowing honored for flattened sync sources (#5984) (abd95ce), closes #5983exhaust to exhaustAll (#5639) (701c7d4)windowBoundaries observable no longer completes the result. It was only ever meant to notify of the window boundary. To get the same behavior as the old behavior, you would need to add an endWith and a skipLast(1) like so: source$.pipe(window(notifier$.pipe(endWith(true))), skipLast(1)).endWith and skipLast(1), like so: source$.pipe(buffer(notifier$.pipe(endWith(true))), skipLast(1))closingNotifier completion no longer completes the result of buffer. If that is truly a desired behavior, then you should use takeUntil. Something like: source$.pipe(buffer(notifier$), takeUntil(notifier$.pipe(ignoreElements(), endWith(true)))), where notifier$ is multicast, although there are many ways to compose this behavior.EMPTY is returned if no observables are passed. (#5963) (157c7e8), closes #5962connect operator. (9d53af0)connectable creation method (f968a79)share completely configurable. Also adds SubjectLike. (2d600c7)expectObservable(a$).toEqual(b$). (3372c72)Subscribable now only supports what is a valid return for [Symbol.observable]().Observer no longer incorrectly has an optional closed property.forkJoin([a$, b$, c$] as const) result is correct (6baec53)unique symbol. (#5874) (374138e), closes #5861 #4415rxjs@7 is only compatible with @types/node@14.14.3 or higher and symbol-observable@3.0.0 and higher. Older versions of @types/node incorrectly defined Symbol.observable and will be in conflict with rxjs and symbol-observable@3.0.0.delayWhen will no longer emit if the duration selector simply completes without a value. Notifiers must notify with a value, not a completion.iif will no longer allow result arguments that are undefined. This was a bad call pattern that was likely an error in most cases. If for some reason you are relying on this behavior, simply substitute EMPTY in place of the undefined argument. This ensures that the behavior was intentional and desired, rather than the result of an accidental undefined argument.from and others. (258dddd), closes #4532mergeScan will no longer emit its inner state again upon completion.pairs will no longer function in IE without a polyfill for Object.entries. pairs itself is also deprecated in favor of users just using from(Object.entries(obj)).zip([[1,2,3]]). But again, that's pretty weird.source observable as a third argument to the predicate. That feature was rarely used, and of limited value. The workaround is to simply close over the source inside of the function if you need to access it in there.new Subscriber no longer takes 0-3 arguments. To create a Subscriber with 0-3 arguments, use Subscriber.create. However, please note that there is little to no reason that you should be creating Subscriber references directly, and Subscriber.create and new Subscriber are both deprecated.Date) passed as an argument (8ae89b1)skipLast will no longer error when passed a negative number, rather it will simply return the source, as though 0 was passed.thisArg will now default to undefined. The previous default of MapSubscriber never made any sense. This will only affect code that calls map with a function and references this like so: source.pipe(map(function () { console.log(this); })). There wasn't anything useful about doing this, so the breakage is expected to be very minimal. If anything we're no longer leaking an implementation detail.console.warn. This is potentially breaking in edge cases for node applications, which may be configured to terminate for unhandled exceptions. In the unlikely event this affects you, you can configure the behavior to console.warn in the new configuration setting like so: import { config } from 'rxjs'; config.onUnhandledError = (err) => console.warn(err);switchMap and exhaustMap behave correctly with re-entrant code. (c289688)add no longer returns unnecessary Subscription reference (#5656) (4de604e)remove will now remove any teardown by reference (#5659) (1531152)Object.create (40a9e77)ajax:
ajax body serialization will now use default XHR behavior in all cases. If the body is a Blob, ArrayBuffer, any array buffer view (like a byte sequence, e.g. Uint8Array, etc), FormData, URLSearchParams, string, or ReadableStream, default handling is use. If the body is otherwise typeof "object", then it will be converted to JSON via JSON.stringify, and the Content-Type header will be set to application/json;charset=utf-8. All other types will emit an error.Content-Type header passed to ajax configuration no longer has any effect on the serialization behavior of the AJAX request.AjaxRequest is no longer the type that should be explicitly used to create an ajax. It is now AjaxConfig, although the two types are compatible, only AjaxConfig has progressSubscriber and createXHR.zip: zip operators will no longer iterate provided iterables "as needed", instead the iterables will be treated as push-streams just like they would be everywhere else in RxJS. This means that passing an endless iterable will result in the thread locking up, as it will endlessly try to read from that iterable. This puts us in-line with all other Rx implementations. To work around this, it is probably best to use map or some combination of map and zip. For example, zip(source$, iterator) could be source$.pipe(map(value => [value, iterator.next().value])).
Subscription: add no longer returns an unnecessary Subscription reference. This was done to prevent confusion caused by a legacy behavior. You can now add and remove functions and Subscriptions as teardowns to and from a Subscription using add and remove directly. Before this, remove only accepted subscriptions.
RxJS Error types Tests that are written with naive expectations against errors may fail now that errors have a proper stack property. In some testing frameworks, a deep equality check on two error instances will check the values in stack, which could be different.
Undocumented Behaviors/APIs Removed:
unsubscribe no longer available via the this context of observer functions. To reenable, set config.useDeprecatedNextContext = true on the rxjs config found at import { config } from 'rxjs';. Note that enabling this will result in a performance penalty for all consumer subscriptions._unsubscribeAndRecycle of Subscriber has been removed. Just use new Subscription objectsretry would result in an observable that repeats forever.repeat would result in an observable that repeats forever.sortActions method on VirtualTimeScheduler is no longer publicly exposed by our TS types.throwError: In an extreme corner case for usage, throwError is no longer able to emit a function as an error directly. If you need to push a function as an error, you will have to use the factory function to return the function like so: throwError(() => functionToEmit), in other words throwError(() => () => console.log('called later')).
progressSubscriber will no longer error (25d279f)"json", we're in IE, and the responseType is not valid JSON, the ajax observable will no longer emit a syntax error, rather it will emit a full AjaxError with more details.lift no longer exposed. It was NEVER documented that end users of the library should be creating operators using lift. Lift has a variety of issues and was always an internal implementation detail of rxjs that might have been used by a few power users in the early days when it had the most value. The value of lift, originally, was that subclassed Observables would compose through all operators that implemented lift. The reality is that feature is not widely known, used, or supported, and it was never documented as it was very experimental when it was first added. Until the end of v7, lift will remain on Observable. Standard JavaScript users will notice no difference. However, TypeScript users might see complaints about lift not being a member of observable. To workaround this issue there are two things you can do: 1. Rewrite your operators as outlined in the documentation, such that they return new Observable. or 2. cast your observable as any and access lift that way. Method 1 is recommended if you do not want things to break when we move to version 8.lift no longer exposed. It was never documented that end users of the library should be creating operators using lift. Lift has a variety of issues and was always an internal implementation detail of rxjs that might have been used by a few power users in the early days when it had the most value. The value of lift, originally, was that subclassed Observables would compose through all operators that implemented lift. The reality is that feature is not widely known, used, or supported, and it was never documented as it was very experimental when it was first added. Until the end of v7, lift will remain on Observable. Standard JavaScript users will notice no difference. However, TypeScript users might see complaints about lift not being a member of observable. To workaround this issue there are two things you can do: 1. Rewrite your operators as outlined in the documentation, such that they return new Observable. or 2. cast your observable as any and access lift that way. It is recommended that operators be implemented in terms of functions that return (source: Observable<T>) => new Observable<R>(...), per the documentation/guide.() => undefined to observableFactory (#5449) (1ae937a), closes #5449single(() => false) on empty observables. (#5325) (27931bc), closes #5325race operator (#5303) (ca7f370)Notification.createNext(undefined) will no longer return the exact same reference every time.Notification and dematerialize, may uncover issues with invalid types passed to those operators.for await as been removed. Use https://github.com/benlesh/rxjs-for-await instead.defer no longer allows factories to return void or undefined. All factories passed to defer must return a proper ObservableInput, such as Observable, Promise, et al. To get the same behavior as you may have relied on previously, return EMPTY or return of() from the factory.single operator will now throw for scenarios where values coming in are either not present, or do not match the provided predicate. Error types have thrown have also been updated, please check documentation for changes.take and will now throw runtime error for arguments that are negative or NaN, this includes non-TS calls like take().
takeLast now has runtime assertions that throw TypeErrors for invalid arguments. Calling takeLast without arguments or with an argument that is NaN will throw a TypeError
ReplaySubject no longer schedules emissions when a scheduler is provided. If you need that behavior,
please compose in observeOn using pipe, for example: new ReplaySubject(2, 3000).pipe(observeOn(asap))
timestamp operator accepts a TimestampProvider, which is any object with a now method
that returns a number. This means pulling in less code for the use of the timestamp operator. This may cause
issues with TestScheduler run mode. (Issue here: https://github.com/ReactiveX/rxjs/issues/5553)
lastValueFrom and firstValueFrom methods (#5295) (e69b765)combineLatestWith - renamed legacy combineLatest operator (#5251) (6d7b146)zipWith which is just a rename of legacy zip operator (#5249) (86b6a27)startWith will return incorrect types when called with more than 7 arguments and a scheduler. Passing scheduler to startWith is deprecatedT | undefined in TypeScript, which is correct, but may break builds.shareReplay completion (#5044) (35e600f), closes #5034this (#4978) (7606dc7)frameTimeFactor property (#4977) (8c32ed0)as.asSchedulerLike may result in the wrong type which includes the SchedulerLike, even though the run time implementation does not support that. Developers should be using scheduled insteadrxjs/Rx is no longer a valid import site.rxjs-compat is not published for v7 (yet)race() will no longer subscribe to subsequent observables if a provided source synchronously errors or completes. This means side effects that might have occurred during subscription in those rare cases will no longer occur.fromFetch static observable creation method from rxjs/fetch. Mirrors native fetch only it's lazy and cancellable via Observable interface. (#4702) (5a1ef86)partition observable creation function. Old partition operator is deprecated (#4419) (#4685) (d5d6980)scheduled creation function to use to create scheduled observable of values. Deprecate scheduled versions of from, range, et al. (#4595) (f57e1fc)operators twice (#4310) (2399f6e)refCount when all resulting subscriptions have unsubscribed. The default behavior is to leave the source subscription running.inclusive option to the operator which causes to emit final value (#4115) (6e7f407)instanceof to avoid megamorphic LoadIC (#4499) (065b4e3)webSocket again, just like it was in 5.0. Now you should import from rxjs/webSocket[Symbol.observable] on them will now be accepted in operators like mergeMap, from, etc (#3562) (c9570df)dom lib (#3566) (8b33ee2)Why "tactical"? Because I TOTALLY MEANT to ruin the release names by publishing an amazingly funny April Fool's joke about smooshMap. So this was "tactical". Super tactical. So very tactical.
serializer: x => x like so: websocket({ url, serializer: x => x })never function (#3386) (53debc8)crossDomain flag in the config.source.mergeMap(x => of(x + x).pipe(map(y => y + x)) (the pattern would be the same for concatMap).NEVER constant instead.map instead: bindCallback(fn1, fn2)() becomes bindCallback(fn1)().pipe(map(fn2))rxjs/Rx is no longer available. Upcoming backwards compat solution will allow thatSymbol.iterator. That would be done by a proper polyfilling libraryObservable.if will have to cast Observable as any to get to if. It is a better idea to just use iif directly via import { iif } from 'rxjs';map instead: bindNodeCallback(fn1, fn2)() becomes bindNodeCallback(fn1)().pipe(map(fn2))map instead: fromEvent(target, 'click', fn) becomes fromEvent(target, 'click').pipe(map(fn))resultSelector argument. To get this same functionality, use map.resultSelector argument. The same functionality can be achieved by simply mapping either before or after first depending on your use case.resultSelector no longer supported, to get this functionality use: source.pipe(exhaustMap(x => of(x + x).pipe(map(y => x + y))))switchMap and switchMapTo no longer take resultSelector arguments, to get the same functionality use switchMap and map in combination: source.pipe(switchMap(x => of(x + x).pipe(y => x + y))).mergeMapTo no longer accepts a resultSelector, to get this functionality, you'll want to use mergeMap and map together: source.pipe(mergeMap(() => inner).pipe(map(y => x + y)))map instead: fromEventPattern(fn1, fn2, fn3) becomes fromEventPattern(fn1, fn2).pipe(map(fn3))never function (#3386) (53debc8)source.mergeMap(x => of(x + x).pipe(map(y => y + x)) (the pattern would be the same for concatMap).map instead: bindCallback(fn1, fn2)() becomes bindCallback(fn1)().pipe(map(fn2))rxjs/Rx is no longer available. Upcoming backwards compat solution will allow thatSymbol.iterator. That would be done by a proper polyfilling libraryObservable.if will have to cast Observable as any to get to if. It is a better idea to just use iif directly via import { iif } from 'rxjs';map instead: bindNodeCallback(fn1, fn2)() becomes bindNodeCallback(fn1)().pipe(map(fn2))NEVER constant instead.map instead: fromEvent(target, 'click', fn) becomes fromEvent(target, 'click').pipe(map(fn))resultSelector argument. To get this same functionality, use map.resultSelector argument. The same functionality can be achieved by simply mapping either before or after first depending on your use case.resultSelector no longer supported, to get this functionality use: source.pipe(exhaustMap(x => of(x + x).pipe(map(y => x + y))))switchMap and switchMapTo no longer take resultSelector arguments, to get the same functionality use switchMap and map in combination: source.pipe(switchMap(x => of(x + x).pipe(y => x + y))).mergeMapTo no longer accepts a resultSelector, to get this functionality, you'll want to use mergeMap and map together: source.pipe(mergeMap(() => inner).pipe(map(y => x + y)))map instead: fromEventPattern(fn1, fn2, fn3) becomes fromEventPattern(fn1, fn2).pipe(map(fn3))rxjs/create items are now exported from rxjsempty() without a scheduler will return the same
instance every time.empty() no longer accepts a generic
argument, as it returns Observable<never>never() always returns the same instancenever() is now Observable<never> and the function no longer requires a generic type.rxjs/operators (34fe560)rxjs/create exports (c9963bd)rxjs/ajax (e971c93)internal directory (7342401)noop and identity from rxjs (810c4d0)Notification from rxjs (8809b48)rxjs (abd3b61)pipe utility function from rxjs (4574310)rxjs/operators (b1f8bfe)rxjs/websocket (5ac62c0)webSocket creator function now exported from rxjs/websocket as websocket.isArray are now hidden under rxjs/internal, they are implementation details and should not be used.HotObservable and ColdObservable, and other testing support types are no longer exported directly.of, from, combineLatest and fromEvent should now be imported from rxjs/create.rxjs/interfaces, import them from rxjs insteadrxjs/symbol/observable please use Symbol.observable and Symbol.iterator (polyfills may be required)rxjs/Observable, rxjs/Subject, rxjs/ReplaySubject, et al. All imports should be done directly from rxjs, for example: import \{ Observable, Subject \} from 'rxjs';Scheduler, (e.g. asap -> asapScheduler)rxjs
like so: import { map, filter, switchMap } from 'rxjs/operators';. No deep imports.rxjs/ajax.ArrayObservable or ForkJoinObservable._throw is now exported as throwErrorif is now exported as iifrxjs/operator/* will no longer work. Again, pipe operators are still where they were.distinct requires a Set implementation and must be polyfilled in older runtimesgroupByObject.setPrototypeOfmerge, concat, zip, onErrorResumeNext, and race have been
removed. Please use the static versions of those operations. e.g.
a.pipe(concat(b, c)) becomes concat(a, b, c).zip and combineLatest are properly inferred. (b8e6cf8)module and es2015 keys to avoid resolution conflicts (5073139)(Due to a publish snafu, there is no 5.5.0-beta.6) (womp womp 👎)
lift (#2924) (3d9cf87), closes #2921Important! Checkout the explanation of the new lettable operators features here
catch (408a2af)this from static methods. (9f8e375)catch after fromPromise. (#2552) (cf88a20)shareReplay variant of publishReplay (#2443) (5a2266a)(NOTE: 5.3.2 was a broken release and was removed)
$$ prefix to work with Babel UMD exporting (#2435) (747bef6), closes #2415smooth() was never really a thing. Sorry, folks. :DwithCredentials after open on XHR for IE10 (#2332) (0ab1d3b)HotObservable and ColdObservable instead of Observable (#2305) (758aae9)add will return Subscription that removes itself when unsubscribed (375d4a5)Scheduler now accept IScheduler interface (a0d28a8)distinctKey (9fd8096), closes #2161Object.prototype.toString.call on objects (#2143) (e036e79)last, first, find and filter. (5f2e849)timeout no longer accepts the errorToSend argumentrelated #2141
thisArg as expected (#2138) (6cf7296)startBufferEvery is less than bufferSize (#2076) (d13dbb4), closes #2062from generators will now finalize when subscription ends (22d286a), closes #1938materialize output will now match Rx4 (#2106) (c83bab9), closes #2105undefined itself as a valid seed (#2050) (fee7585), closes #2047distinctKey, distinct signature change and perf improvements (#2049) (89612b2), closes #2009Notification.prototype.exception is now Notification.prototype.error to match Rx4 semanticsSymbol.iterator if Symbol does not exist. This may break code that inadvertently relies on this behaviorObject.assign. It does
not require Object.assign to function, however, your code may be
inadvertently relying on this polyfill.getJSON<T>(url: string, headers?: Object): Observable<T>.
The extra type parameter it accepted previously was superfluous.distinctKey has been removed. Use distinctdistinct operator has changed, first argument is an
optional keySelector. The custom compare function is no longer
supported.cache operator (1b23ace)rxjs-es, ES2015 output no longer included in @reactivex/rxjs package under /dist/es6 (6be9968), closes #1671rxjs-es is no longer being published@reactivex/rxjs no longer has /dist/es6 outputEven if we use getter for class, they are marked with readonly properties
in d.ts.
any to access to private field in source (54f342f)map insteadScheduler.async (#1807) (12c5c74), closes [(#1807](https://github.com/(/issues/1807) #1806maxBufferSize optional argument (cf45540), closes #1295Rx.kitchenSink and Rx.DOM are removed, Rx
export everything.Operator.prototype.call has been refactored to include both the destination Subscriber, and the source Observable
the Operator is now responsible for describing it's own subscription process. (26423f4)add() now returns a Subscription reference (a3f4552)Observable.fromArray was removed since it's deprecated on RxJS 4. You should use Observable.from instead.Subject.create(observable, observer) is now Subject.create(observer, observable)of and from can now be found in rxjs/add/observable/of, rxjs/add/observable/from, etc.PromiseObservable, ArrayObservable are now in appropriately named files like rxjs/observable/PromiseObservable and rxjs/observable/ArrayObservable
as opposed to rxjs/observable/fromPromise and rxjs/observable/fromArray, since they're not patching, they simply house the Observable implementations.inspect and inspectTime were removed. Use withLatestFrom instead.sample operator (e93bffc)sampleTime with RxJS 4 behavior (6b77e69)sampleTime now has the same behavior sample(number, scheduler) did in RxJS 4sample behavior returned to RxJS 4 behaviorsampleTime is now inspectTimesample behavior is now inspectimport "rxjs/add/operator/extended/min" is now import "rxjs/add/operator/min"Rx.Scheduler.nextTick (Rx 4's "default" scheduler) is now Rx.Scheduler.asapRx.Scheduler.immediate (Rx 4's "currentThread" scheduler) is now Rx.Scheduler.queue
related #838switchMapFirst is now switchFirstMap