diff --git a/api_guard/dist/types/operators/index.d.ts b/api_guard/dist/types/operators/index.d.ts index 70c28edab9..cfff96d807 100644 --- a/api_guard/dist/types/operators/index.d.ts +++ b/api_guard/dist/types/operators/index.d.ts @@ -57,7 +57,6 @@ export declare function defaultIfEmpty(defaultValue: R): OperatorFunction< export declare function delay(due: number | Date, scheduler?: SchedulerLike): MonoTypeOperatorFunction; -export declare function delayWhen(delayDurationSelector: (value: T, index: number) => Observable, subscriptionDelay?: Observable): MonoTypeOperatorFunction; export declare function delayWhen(delayDurationSelector: (value: T, index: number) => Observable, subscriptionDelay: Observable): MonoTypeOperatorFunction; export declare function delayWhen(delayDurationSelector: (value: T, index: number) => Observable): MonoTypeOperatorFunction; diff --git a/docs_app/content/deprecations/multicasting.md b/docs_app/content/deprecations/multicasting.md new file mode 100644 index 0000000000..dba9c8244e --- /dev/null +++ b/docs_app/content/deprecations/multicasting.md @@ -0,0 +1,429 @@ +# Multicasting + +In version 7, the multicasting APIs were simplified to just a few functions: + +- [connectable](/api/index/function/connectable) +- [connect](/api/operators/connect) +- [share](/api/operators/share) + +And [shareReplay](/api/operators/shareReplay) - which is a thin wrapper around the now highly-configurable [share](/api/operators/share) operator. + +Other APIs that relate to multicasting are now deprecated. + +
+ + These deprecations were introduced in RxJS 7.0 and will become breaking in RxJS 8. + +
+ +## APIs affected by this Change + +- [ConnectableObservable](/api/index/class/ConnectableObservable) +- [multicast](/api/operators/multicast) +- [publish](/api/operators/publish) +- [publishBehavior](/api/operators/publishBehavior) +- [publishLast](/api/operators/publishLast) +- [publishReplay](/api/operators/publishReplay) +- [refCount](/api/operators/refCount) + +## How to refactor + +### ConnectableObservable + +Instead of creating a [ConnectableObservable](/api/index/class/ConnectableObservable) instance, call the [connectable](/api/index/function/connectable) function to obtain a connectable observable. + + +```ts +import { ConnectableObservable, Subject, timer } from 'rxjs'; +// deprecated +const tick$ = new ConnectableObservable( + timer(1_000), + () => new Subject()); +tick$.connect(); +``` + + +```ts +import { connectable, Subject, timer } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new Subject() +}); +tick$.connect(); +``` + +In situations in which the `refCount` method is used, the [share](/api/operators/share) operator can be used instead. + + +```ts +import { ConnectableObservable, Subject, timer } from 'rxjs'; +// deprecated +const tick$ = new ConnectableObservable( + timer(1_000), + () => new Subject() +).refCount(); +``` + + +```ts +import { share, Subject, timer } from 'rxjs'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ connector: () => new Subject() }) +); +``` + +### multicast + +Where [multicast](/api/operators/multicast) is called with a subject factory, can be replaced with [connectable](/api/index/function/connectable). + + +```ts +import { ConnectableObservable, timer, Subject } from 'rxjs'; +import { multicast } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + multicast(() => new Subject()) +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer, Subject } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new Subject() +}); +``` + +Where [multicast](/api/operators/multicast) is called with a subject instance, it can be replaced with [connectable](/api/index/function/connectable) and a local subject instance. + + +```ts +import { ConnectableObservable, timer, Subject } from 'rxjs'; +import { multicast } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + multicast(new Subject()) +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer, Subject } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new Subject(), + resetOnDisconnect: false +}); +``` + +Where [multicast](/api/operators/multicast) is used in conjunction with [refCount](/api/operators/refCount), it can be replaced with [share](/api/index/function/connectable). + + +```ts +import { timer, Subject } from 'rxjs'; +import { multicast, refCount } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + multicast(() => new Subject()), + refCount() +); +``` + + +```ts +import { timer, Subject } from 'rxjs'; +import { share } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ connector: () => new Subject() }) +); +``` + +Where [multicast](/api/operators/multicast) is used with a selector, it can be replaced with [connect](/api/index/function/connect). + + +```ts +import { timer, combineLatest } from 'rxjs'; +import { multicast } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + multicast( + () => new Subject(), + (source) => combineLatest([source, source]) + ) +); +``` + + +```ts +import { timer, combineLatest } from 'rxjs'; +import { connect } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + connect((source) => combineLatest([source, source]), { + connector: () => new Subject() + }) +); +``` + +### publish + +If you're using [publish](/api/operators/publish) to create a [ConnectableObservable](/api/index/class/ConnectableObservable), you can use [connectable](/api/index/function/connectable) instead. + + +```ts +import { ConnectableObservable, timer } from 'rxjs'; +import { publish } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publish() +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new Subject(), + resetOnDisconnect: false +}); +``` + +And if [refCount](/api/operators/refCount) is being applied to the result of [publish](/api/operators/publish), you can use [share](/api/operators/share) to replace both. + + +```ts +import { timer } from 'rxjs'; +import { publish, refCount } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publish(), + refCount() +); +``` + + +```ts +import { timer } from 'rxjs'; +import { share } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ + resetOnError: false, + resetOnComplete: false, + resetOnRefCountZero: false, + }) +); +``` + +If [publish](/api/operators/publish) is being called with a selector, you can use the [connect](/api/operators/connect) operator instead. + + +```ts +import { timer, combineLatest } from 'rxjs'; +import { publish } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publish((source) => combineLatest([source, source])) +); +``` + + +```ts +import { timer, combineLatest } from 'rxjs'; +import { connect } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + connect((source) => combineLatest([source, source])) +); +``` + +### publishBehavior + +If you're using [publishBehavior](/api/operators/publishBehavior) to create a [ConnectableObservable](/api/index/class/ConnectableObservable), you can use [connectable](/api/index/function/connectable) and a [BehaviorSubject](api/index/class/BehaviorSubject) instead. + + +```ts +import { ConnectableObservable, timer } from 'rxjs'; +import { publishBehavior } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishBehavior(0) +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer, BehaviorSubject } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new BehaviorSubject(0), + resetOnDisconnect: false +}); +``` + +And if [refCount](/api/operators/refCount) is being applied to the result of [publishBehavior](/api/operators/publishBehavior), you can use the [share](/api/operators/share) operator - with a [BehaviorSubject](api/index/class/BehaviorSubject) connector - to replace both. + + +```ts +import { timer } from 'rxjs'; +import { publishBehavior, refCount } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishBehavior(0), + refCount() +); +``` + + +```ts +import { timer, BehaviorSubject } from 'rxjs'; +import { share } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ + connector: () => new BehaviorSubject(0), + resetOnError: false, + resetOnComplete: false, + resetOnRefCountZero: false, + }) +); +``` + +### publishLast + +If you're using [publishLast](/api/operators/publishLast) to create a [ConnectableObservable](/api/index/class/ConnectableObservable), you can use [connectable](/api/index/function/connectable) and an [AsyncSubject](api/index/class/AsyncSubject) instead. + + +```ts +import { ConnectableObservable, timer } from 'rxjs'; +import { publishLast } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishLast() +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer, AsyncSubject } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new AsyncSubject(), + resetOnDisconnect: false +}); +``` + +And if [refCount](/api/operators/refCount) is being applied to the result of [publishLast](/api/operators/publishLast), you can use the [share](/api/operators/share) operator - with an [AsyncSubject](api/index/class/AsyncSubject) connector - to replace both. + + +```ts +import { timer } from 'rxjs'; +import { publishLast, refCount } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishLast(), + refCount() +); +``` + + +```ts +import { timer, AsyncSubject } from 'rxjs'; +import { share } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ + connector: () => new AsyncSubject(), + resetOnError: false, + resetOnComplete: false, + resetOnRefCountZero: false, + }) +); +``` + +### publishReplay + +If you're using [publishReplay](/api/operators/publishReplay) to create a [ConnectableObservable](/api/index/class/ConnectableObservable), you can use [connectable](/api/index/function/connectable) and a [ReplaySubject](api/index/class/ReplaySubject) instead. + + +```ts +import { ConnectableObservable, timer } from 'rxjs'; +import { publishReplay } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishReplay(1) +) as ConnectableObservable; +``` + + +```ts +import { connectable, timer, ReplaySubject } from 'rxjs'; +// suggested refactor +const tick$ = connectable(timer(1_000), { + connector: () => new ReplaySubject(1), + resetOnDisconnect: false +}); +``` + +And if [refCount](/api/operators/refCount) is being applied to the result of [publishReplay](/api/operators/publishReplay), you can use the [share](/api/operators/share) operator - with a [ReplaySubject](api/index/class/ReplaySubject) connector - to replace both. + + +```ts +import { timer } from 'rxjs'; +import { publishReplay, refCount } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishReplay(1), + refCount() +); +``` + + +```ts +import { timer, ReplaySubject } from 'rxjs'; +import { share } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + share({ + connector: () => new ReplaySubject(1), + resetOnError: false, + resetOnComplete: false, + resetOnRefCountZero: false, + }) +); +``` + +If [publishReplay](/api/operators/publishReplay) is being called with a selector, you can use the [connect](/api/operators/connect) operator - with a [ReplaySubject](api/index/class/ReplaySubject) connector - instead. + + +```ts +import { timer, combineLatest } from 'rxjs'; +import { publishReplay } from 'rxjs/operators'; +// deprecated +const tick$ = timer(1_000).pipe( + publishReplay(1, undefined, (source) => combineLatest([source, source])) +); +``` + + +```ts +import { timer, combineLatest, ReplaySubject } from 'rxjs'; +import { connect } from 'rxjs/operators'; +// suggested refactor +const tick$ = timer(1_000).pipe( + connect((source) => combineLatest([source, source]), { + connector: () => new ReplaySubject(1) + }) +); +``` + +### refCount + +Instead of applying the [refCount](/api/operators/refCount) operator to the [ConnectableObservable](/api/index/class/ConnectableObservable) obtained from a [multicast](/api/operators/multicast) +or [publish](/api/operators/publish) operator, use the [share](/api/operators/share) operator to replace both. + +The properties passed to [share](/api/operators/share) will depend upon the operators that are being replaced. The refactors for using [refCount](/api/operators/refCount) with [multicast](/api/operators/multicast), [publish](/api/operators/publish), [publishBehavior](/api/operators/publishBehavior), [publishLast](/api/operators/publishLast) and [publishReplay](/api/operators/publishReplay) are detailed above. diff --git a/docs_app/content/navigation.json b/docs_app/content/navigation.json index 310b57c94f..b9e9ae18eb 100644 --- a/docs_app/content/navigation.json +++ b/docs_app/content/navigation.json @@ -92,6 +92,10 @@ { "url": "deprecations/array-argument", "title": "Array Arguments" + }, + { + "url": "deprecations/multicasting", + "title": "Multicasting" } ] }, diff --git a/spec-dtslint/operators/delayWhen-spec.ts b/spec-dtslint/operators/delayWhen-spec.ts index d0f4393865..2924fd3607 100644 --- a/spec-dtslint/operators/delayWhen-spec.ts +++ b/spec-dtslint/operators/delayWhen-spec.ts @@ -27,9 +27,3 @@ it('should enforce types of delayWhenDurationSelector', () => { it('should enforce types of subscriptiondelayWhen', () => { const o = of(1, 2, 3).pipe(delayWhen(() => of('a', 'b', 'c'), 'a')); // $ExpectError }); - -it('should deprecates', () => { - of(1, 2, 3).pipe(delayWhen(() => NEVER)); // $ExpectDeprecation - of(1, 2, 3).pipe(delayWhen(() => of('a', 'b', 'c'), of(0))); // $ExpectDeprecation - of(1, 2, 3).pipe(delayWhen(() => of('a', 'b', 'c'))); // $ExpectNoDeprecation -}); diff --git a/src/internal/Notification.ts b/src/internal/Notification.ts index 98fb2e33cb..de15f67c97 100644 --- a/src/internal/Notification.ts +++ b/src/internal/Notification.ts @@ -7,7 +7,8 @@ import { isFunction } from './util/isFunction'; // TODO: When this enum is removed, replace it with a type alias. See #4556. /** - * @deprecated NotificationKind is deprecated as const enums are not compatible with isolated modules. Use a string literal instead. + * @deprecated Use a string literal instead. `NotificationKind` will be replaced with a type alias in v8. + * It will not be replaced with a const enum as those are not compatible with isolated modules. */ export enum NotificationKind { NEXT = 'N', @@ -26,15 +27,16 @@ export enum NotificationKind { * @see {@link materialize} * @see {@link dematerialize} * @see {@link observeOn} - * @deprecated remove in v8. It is NOT recommended to create instances of `Notification` directly - * and use them. Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. - * For example: `{ kind: 'N', value: 1 }`, `{kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * @deprecated It is NOT recommended to create instances of `Notification` directly. + * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. + * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * Will be removed in v8. */ export class Notification { /** * A value signifying that the notification will "next" if observed. In truth, - * This is really synonomous with just checking `kind === "N"`. - * @deprecated remove in v8. Instead, just check to see if the value of `kind` is `"N"`. + * This is really synonymous with just checking `kind === "N"`. + * @deprecated Will be removed in v8. Instead, just check to see if the value of `kind` is `"N"`. */ readonly hasValue: boolean; @@ -42,7 +44,7 @@ export class Notification { * Creates a "Next" notification object. * @param kind Always `'N'` * @param value The value to notify with if observed. - * @deprecated internal as of v8. Use {@link createNext} instead. + * @deprecated Internal implementation detail. Use {@link createNext} instead. */ constructor(kind: 'N', value?: T); /** @@ -50,13 +52,13 @@ export class Notification { * @param kind Always `'E'` * @param value Always `undefined` * @param error The error to notify with if observed. - * @deprecated internal as of v8. Use {@link createError} instead. + * @deprecated Internal implementation detail. Use {@link createError} instead. */ constructor(kind: 'E', value: undefined, error: any); /** * Creates a "completion" notification object. * @param kind Always `'C'` - * @deprecated internal as of v8. Use {@link createComplete} instead. + * @deprecated Internal implementation detail. Use {@link createComplete} instead. */ constructor(kind: 'C'); constructor(public readonly kind: 'N' | 'E' | 'C', public readonly value?: T, public readonly error?: any) { @@ -80,7 +82,7 @@ export class Notification { * @param next A next handler * @param error An error handler * @param complete A complete handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ do(next: (value: T) => void, error: (err: any) => void, complete: () => void): void; /** @@ -89,14 +91,14 @@ export class Notification { * and no error is thrown, it will be a noop. * @param next A next handler * @param error An error handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ do(next: (value: T) => void, error: (err: any) => void): void; /** * Executes the next handler if the Notification is of `kind` `"N"`. Otherwise * this will not error, and it will be a noop. * @param next The next handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ do(next: (value: T) => void): void; do(nextHandler: (value: T) => void, errorHandler?: (err: any) => void, completeHandler?: () => void): void { @@ -111,7 +113,7 @@ export class Notification { * @param next A next handler * @param error An error handler * @param complete A complete handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ accept(next: (value: T) => void, error: (err: any) => void, complete: () => void): void; /** @@ -120,14 +122,14 @@ export class Notification { * and no error is thrown, it will be a noop. * @param next A next handler * @param error An error handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ accept(next: (value: T) => void, error: (err: any) => void): void; /** * Executes the next handler if the Notification is of `kind` `"N"`. Otherwise * this will not error, and it will be a noop. * @param next The next handler - * @deprecated remove in v8. use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ accept(next: (value: T) => void): void; @@ -136,7 +138,7 @@ export class Notification { * If the handler is missing it will do nothing. Even if the notification is an error, if * there is no error handler on the observer, an error will not be thrown, it will noop. * @param observer The observer to notify. - * @deprecated remove in v8. Use {@link Notification.prototype.observe} instead. + * @deprecated Replaced with {@link Notification.prototype.observe}. Will be removed in v8. */ accept(observer: PartialObserver): void; accept(nextOrObserver: PartialObserver | ((value: T) => void), error?: (err: any) => void, complete?: () => void) { @@ -149,9 +151,8 @@ export class Notification { * Returns a simple Observable that just delivers the notification represented * by this Notification instance. * - * @deprecated remove in v8. In order to accomplish converting `Notification` to an {@link Observable} - * you may use {@link of} and {@link dematerialize}: `of(notification).pipe(dematerialize())`. This is - * being removed as it has limited usefulness, and we're trying to streamline the library. + * @deprecated Will be removed in v8. To convert a `Notification` to an {@link Observable}, + * use {@link of} and {@link dematerialize}: `of(notification).pipe(dematerialize())`. */ toObservable(): Observable { const { kind, value, error } = this; @@ -187,9 +188,10 @@ export class Notification { * @return {Notification} The "next" Notification representing the * argument. * @nocollapse - * @deprecated remove in v8. It is NOT recommended to create instances of `Notification` directly - * and use them. Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. - * For example: `{ kind: 'N', value: 1 }`, `{kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * @deprecated It is NOT recommended to create instances of `Notification` directly. + * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. + * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * Will be removed in v8. */ static createNext(value: T) { return new Notification('N', value) as Notification & NextNotification; @@ -202,9 +204,10 @@ export class Notification { * @return {Notification} The "error" Notification representing the * argument. * @nocollapse - * @deprecated remove in v8. It is NOT recommended to create instances of `Notification` directly - * and use them. Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. - * For example: `{ kind: 'N', value: 1 }`, `{kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * @deprecated It is NOT recommended to create instances of `Notification` directly. + * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. + * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * Will be removed in v8. */ static createError(err?: any) { return new Notification('E', undefined, err) as Notification & ErrorNotification; @@ -214,9 +217,10 @@ export class Notification { * A shortcut to create a Notification instance of the type `complete`. * @return {Notification} The valueless "complete" Notification. * @nocollapse - * @deprecated remove in v8. It is NOT recommended to create instances of `Notification` directly - * and use them. Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. - * For example: `{ kind: 'N', value: 1 }`, `{kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * @deprecated It is NOT recommended to create instances of `Notification` directly. + * Rather, try to create POJOs matching the signature outlined in {@link ObservableNotification}. + * For example: `{ kind: 'N', value: 1 }`, `{ kind: 'E', error: new Error('bad') }`, or `{ kind: 'C' }`. + * Will be removed in v8. */ static createComplete(): Notification & CompleteNotification { return Notification.completeNotification; diff --git a/src/internal/Observable.ts b/src/internal/Observable.ts index c91680eba5..a0c569ba35 100644 --- a/src/internal/Observable.ts +++ b/src/internal/Observable.ts @@ -18,12 +18,12 @@ import { isFunction } from './util/isFunction'; */ export class Observable implements Subscribable { /** - * @deprecated This is an internal implementation detail, do not use. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ source: Observable | undefined; /** - * @deprecated This is an internal implementation detail, do not use. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ operator: Operator | undefined; @@ -43,13 +43,13 @@ export class Observable implements Subscribable { // HACK: Since TypeScript inherits static properties too, we have to // fight against TypeScript here so Subject can have a different static create signature /** - * Creates a new cold Observable by calling the Observable constructor + * Creates a new Observable by calling the Observable constructor * @owner Observable * @method create * @param {Function} subscribe? the subscriber function to be passed to the Observable constructor - * @return {Observable} a new cold observable + * @return {Observable} a new observable * @nocollapse - * @deprecated use new Observable() instead + * @deprecated Use `new Observable()` instead. Will be removed in v8. */ static create: (...args: any[]) => any = (subscribe?: (subscriber: Subscriber) => TeardownLogic) => { return new Observable(subscribe); @@ -61,9 +61,10 @@ export class Observable implements Subscribable { * @method lift * @param operator the operator defining the operation to take on the observable * @return a new observable with the Operator applied - * @deprecated This is an internal implementation detail, do not use directly. If you have implemented an operator - * using `lift`, it is recommended that you create an operator by simply returning `new Observable()` directly. - * See "Creating new operators from scratch" section here: https://rxjs.dev/guide/operators + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. + * If you have implemented an operator using `lift`, it is recommended that you create an + * operator by simply returning `new Observable()` directly. See "Creating new operators from + * scratch" section here: https://rxjs.dev/guide/operators */ lift(operator?: Operator): Observable { const observable = new Observable(); @@ -74,7 +75,7 @@ export class Observable implements Subscribable { subscribe(observer?: Partial>): Subscription; subscribe(next: (value: T) => void): Subscription; - /** @deprecated Use an observer instead of a complete callback, Details: https://rxjs.dev/deprecations/subscribe-arguments */ + /** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */ subscribe(next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, complete?: (() => void) | null): Subscription; /** * Invokes an execution of an Observable and registers Observer handlers for notifications it will emit. @@ -343,11 +344,11 @@ export class Observable implements Subscribable { * @param promiseCtor a constructor function used to instantiate the Promise * @return a promise that either resolves on observable completion or * rejects with the handled error - * @deprecated remove in v8. Passing a Promise constructor will no longer be available + * @deprecated Passing a Promise constructor will no longer be available * in upcoming versions of RxJS. This is because it adds weight to the library, for very * little benefit. If you need this functionality, it is recommended that you either * polyfill Promise, or you create an adapter to convert the returned native promise - * to whatever promise implementation you wanted. + * to whatever promise implementation you wanted. Will be removed in v8. */ forEach(next: (value: T) => void, promiseCtor: PromiseConstructorLike): Promise; @@ -482,11 +483,11 @@ export class Observable implements Subscribable { } /* tslint:disable:max-line-length */ - /** @deprecated Deprecated use {@link firstValueFrom} or {@link lastValueFrom} instead */ + /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. */ toPromise(): Promise; - /** @deprecated Deprecated use {@link firstValueFrom} or {@link lastValueFrom} instead */ + /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. */ toPromise(PromiseCtor: typeof Promise): Promise; - /** @deprecated Deprecated use {@link firstValueFrom} or {@link lastValueFrom} instead */ + /** @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. */ toPromise(PromiseCtor: PromiseConstructorLike): Promise; /* tslint:enable:max-line-length */ @@ -506,7 +507,7 @@ export class Observable implements Subscribable { * @return A Promise that resolves with the last value emit, or * rejects on an error. If there were no emissions, Promise * resolves with undefined. - * @deprecated Deprecated use {@link firstValueFrom} or {@link lastValueFrom} instead + * @deprecated Replaced with {@link firstValueFrom} and {@link lastValueFrom}. Will be removed in v8. */ toPromise(promiseCtor?: PromiseConstructorLike): Promise { promiseCtor = getPromiseCtor(promiseCtor); diff --git a/src/internal/Operator.ts b/src/internal/Operator.ts index 08aa5e438e..ab7bc50a16 100644 --- a/src/internal/Operator.ts +++ b/src/internal/Operator.ts @@ -2,7 +2,7 @@ import { Subscriber } from './Subscriber'; import { TeardownLogic } from './types'; /*** - * @deprecated Internal implementation detail, do not use. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ export interface Operator { call(subscriber: Subscriber, source: any): TeardownLogic; diff --git a/src/internal/Scheduler.ts b/src/internal/Scheduler.ts index 2a5b558dbd..7906d22259 100644 --- a/src/internal/Scheduler.ts +++ b/src/internal/Scheduler.ts @@ -1,7 +1,7 @@ import { Action } from './scheduler/Action'; import { Subscription } from './Subscription'; import { SchedulerLike, SchedulerAction } from './types'; -import { dateTimestampProvider } from "./scheduler/dateTimestampProvider"; +import { dateTimestampProvider } from './scheduler/dateTimestampProvider'; /** * An execution context and a data structure to order tasks and schedule their @@ -20,14 +20,12 @@ import { dateTimestampProvider } from "./scheduler/dateTimestampProvider"; * @class Scheduler * @deprecated Scheduler is an internal implementation detail of RxJS, and * should not be used directly. Rather, create your own class and implement - * {@link SchedulerLike} + * {@link SchedulerLike}. Will be made internal in v8. */ export class Scheduler implements SchedulerLike { - public static now: () => number = dateTimestampProvider.now; - constructor(private schedulerActionCtor: typeof Action, - now: () => number = Scheduler.now) { + constructor(private schedulerActionCtor: typeof Action, now: () => number = Scheduler.now) { this.now = now; } diff --git a/src/internal/Subject.ts b/src/internal/Subject.ts index 1edb3ca52b..57f5d9d42a 100644 --- a/src/internal/Subject.ts +++ b/src/internal/Subject.ts @@ -15,20 +15,20 @@ import { arrRemove } from './util/arrRemove'; */ export class Subject extends Observable implements SubscriptionLike { closed = false; - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ observers: Observer[] = []; - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ isStopped = false; - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ hasError = false; - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ thrownError: any = null; /** * Creates a "subject" by basically gluing an observer to an observable. * * @nocollapse - * @deprecated Recommended you do not use, will be removed at some point in the future. Plans for replacement still under discussion. + * @deprecated Recommended you do not use. Will be removed at some point in the future. Plans for replacement still under discussion. */ static create: (...args: any[]) => any = (destination: Observer, source: Observable): AnonymousSubject => { return new AnonymousSubject(destination, source); @@ -39,7 +39,7 @@ export class Subject extends Observable implements SubscriptionLike { super(); } - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ lift(operator: Operator): Observable { const subject = new AnonymousSubject(this, this); subject.operator = operator as any; @@ -140,7 +140,7 @@ export class Subject extends Observable implements SubscriptionLike { */ export class AnonymousSubject extends Subject { constructor( - /** @deprecated Internal implementation detail, do not use. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ public destination?: Observer, source?: Observable ) { diff --git a/src/internal/Subscriber.ts b/src/internal/Subscriber.ts index e88179609d..dca298dbec 100644 --- a/src/internal/Subscriber.ts +++ b/src/internal/Subscriber.ts @@ -29,19 +29,22 @@ export class Subscriber extends Subscription implements Observer { * @return A Subscriber wrapping the (partially defined) * Observer represented by the given arguments. * @nocollapse - * @deprecated Do not use. Will be removed in v8. There is no replacement for this method, and there is no reason to be creating instances of `Subscriber` directly. If you have a specific use case, please file an issue. + * @deprecated Do not use. Will be removed in v8. There is no replacement for this + * method, and there is no reason to be creating instances of `Subscriber` directly. + * If you have a specific use case, please file an issue. */ static create(next?: (x?: T) => void, error?: (e?: any) => void, complete?: () => void): Subscriber { return new SafeSubscriber(next, error, complete); } - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ protected isStopped: boolean = false; - /** @deprecated This is an internal implementation detail, do not use directly. */ + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ protected destination: Subscriber | Observer; // this `any` is the escape hatch to erase extra type param (e.g. R) /** - * @deprecated Do not use directly. There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. + * There is no reason to directly create an instance of Subscriber. This type is exported for typings reasons. */ constructor(destination?: Subscriber | Observer) { super(); diff --git a/src/internal/ajax/AjaxResponse.ts b/src/internal/ajax/AjaxResponse.ts index 569fd741b5..082d359d99 100644 --- a/src/internal/ajax/AjaxResponse.ts +++ b/src/internal/ajax/AjaxResponse.ts @@ -25,9 +25,9 @@ export class AjaxResponse { readonly response: T; /** - * The responseType set on the request. (For example: `""`, "arraybuffer"`, "blob"`, "document"`, "json"`, or `"text"`) - * @deprecated There isn't much reason to examine this. It's the same responseType set (or defaulted) on the ajax config - * if you really need to examine this value, you can check it on the `request` or the `xhr`. + * The responseType set on the request. (For example: `""`, `"arraybuffer"`, `"blob"`, `"document"`, `"json"`, or `"text"`) + * @deprecated There isn't much reason to examine this. It's the same responseType set (or defaulted) on the ajax config. + * If you really need to examine this value, you can check it on the `request` or the `xhr`. Will be removed in v8. */ readonly responseType: XMLHttpRequestResponseType; diff --git a/src/internal/ajax/types.ts b/src/internal/ajax/types.ts index cc2a30386d..2a2660e491 100644 --- a/src/internal/ajax/types.ts +++ b/src/internal/ajax/types.ts @@ -181,8 +181,8 @@ export interface AjaxConfig { * This will **not** error for errored status codes. Rather, it will always _complete_ when * the HTTP response comes back. * - * @deprecated If you're looking for progress events, please try {@link includeDownloadProgress} and - * {@link includeUploadProgress}. This will be removed in version 8. + * @deprecated If you're looking for progress events, use {@link includeDownloadProgress} and + * {@link includeUploadProgress} instead. Will be removed in v8. */ progressSubscriber?: PartialObserver; diff --git a/src/internal/config.ts b/src/internal/config.ts index e21c55d1ed..814abcedd8 100644 --- a/src/internal/config.ts +++ b/src/internal/config.ts @@ -33,9 +33,9 @@ export const config = { * The promise constructor used by default for methods such as * {@link toPromise} and {@link forEach} * - * @deprecated remove in v8. RxJS will no longer support this sort of injection of a + * @deprecated As of version 8, RxJS will no longer support this sort of injection of a * Promise constructor. If you need a Promise implementation other than native promises, - * please polyfill/patch Promises as you see appropriate. + * please polyfill/patch Promise as you see appropriate. Will be removed in v8. */ Promise: undefined as PromiseConstructorLike | undefined, @@ -47,9 +47,9 @@ export const config = { * an unhandled error. DO NOT USE THIS FLAG UNLESS IT'S NEEDED TO BUY TIME * FOR MIGRATION REASONS. * - * @deprecated remove in v8. As of version 8, RxJS will no longer support synchronous throwing + * @deprecated As of version 8, RxJS will no longer support synchronous throwing * of unhandled errors. All errors will be thrown on a separate call stack to prevent bad - * behaviors described above. + * behaviors described above. Will be removed in v8. */ useDeprecatedSynchronousErrorHandling: false, @@ -62,10 +62,10 @@ export const config = { * issues when types other than POJOs are passed to subscribe as subscribers, as they will likely have * their `this` context overwritten. * - * @deprecated remove in v8. As of version 8, RxJS will no longer support altering the + * @deprecated As of version 8, RxJS will no longer support altering the * context of next functions provided as part of an observer to Subscribe. Instead, * you will have access to a subscription or a signal or token that will allow you to do things like - * unsubscribe and test closed status. + * unsubscribe and test closed status. Will be removed in v8. */ useDeprecatedNextContext: false, }; diff --git a/src/internal/observable/ConnectableObservable.ts b/src/internal/observable/ConnectableObservable.ts index 03e3844501..012a7bc8a7 100644 --- a/src/internal/observable/ConnectableObservable.ts +++ b/src/internal/observable/ConnectableObservable.ts @@ -8,9 +8,10 @@ import { hasLift } from '../util/lift'; /** * @class ConnectableObservable - * @deprecated To be removed in version 8. Please use {@link connectable} to create a connectable observable. - * If you are using the `refCount` method of `ConnectableObservable` you can use the updated {@link share} operator - * instead, which is now highly configurable. + * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable. + * If you are using the `refCount` method of `ConnectableObservable`, use the {@link share} operator + * instead. + * Details: https://rxjs.dev/deprecations/multicasting */ export class ConnectableObservable extends Observable { protected _subject: Subject | null = null; @@ -20,12 +21,13 @@ export class ConnectableObservable extends Observable { /** * @param source The source observable * @param subjectFactory The factory that creates the subject used internally. - * @deprecated To be removed in version 8. Please use {@link connectable} to create a connectable observable. - * If you are using the `refCount` method of `ConnectableObservable` you can use the {@link share} operator - * instead, which is now highly configurable. `new ConnectableObservable(source, fn)` is equivalent - * to `connectable(source, fn)`. With the exception of when the `refCount()` method is needed, in which - * case, the new {@link share} operator should be used: `new ConnectableObservable(source, fn).refCount()` - * is equivalent to `source.pipe(share({ connector: fn }))`. + * @deprecated Will be removed in v8. Use {@link connectable} to create a connectable observable. + * `new ConnectableObservable(source, factory)` is equivalent to + * `connectable(source, { connector: factory })`. + * When the `refCount()` method is needed, the {@link share} operator should be used instead: + * `new ConnectableObservable(source, factory).refCount()` is equivalent to + * `source.pipe(share({ connector: factory }))`. + * Details: https://rxjs.dev/deprecations/multicasting */ constructor(public source: Observable, protected subjectFactory: () => Subject) { super(); @@ -57,6 +59,10 @@ export class ConnectableObservable extends Observable { _connection?.unsubscribe(); } + /** + * @deprecated {@link ConnectableObservable} will be removed in v8. Use {@link connecatble} instead. + * Details: https://rxjs.dev/deprecations/multicasting + */ connect(): Subscription { let connection = this._connection; if (!connection) { @@ -89,8 +95,8 @@ export class ConnectableObservable extends Observable { } /** - * @deprecated The {@link ConnectableObservable} class is scheduled for removal in version 8. - * Please use the {@link share} operator, which is now highly configurable. + * @deprecated {@link ConnectableObservable} will be removed in v8. Use the {@link share} operator instead. + * Details: https://rxjs.dev/deprecations/multicasting */ refCount(): Observable { return higherOrderRefCount()(this) as Observable; diff --git a/src/internal/observable/combineLatest.ts b/src/internal/observable/combineLatest.ts index b915b4192f..c573f02c8e 100644 --- a/src/internal/observable/combineLatest.ts +++ b/src/internal/observable/combineLatest.ts @@ -27,7 +27,7 @@ export function combineLatest(arg: T): Observable // combineLatest([a, b, c]) export function combineLatest(sources: []): Observable; export function combineLatest(sources: readonly [...ObservableInputTuple]): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and combineLatestAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function combineLatest( sources: readonly [...ObservableInputTuple], resultSelector: (...values: A) => R, @@ -37,24 +37,24 @@ export function combineLatest( sources: readonly [...ObservableInputTuple], resultSelector: (...values: A) => R ): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and combineLatestAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function combineLatest( sources: readonly [...ObservableInputTuple], scheduler: SchedulerLike ): Observable; // combineLatest(a, b, c) -/** @deprecated Use the version that takes an array of Observables instead */ +/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */ export function combineLatest(...sources: [...ObservableInputTuple]): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and combineLatestAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function combineLatest( ...sourcesAndResultSelectorAndScheduler: [...ObservableInputTuple, (...values: A) => R, SchedulerLike] ): Observable; -/** @deprecated Use the version that takes an array of Observables instead. (e.g. `combineLatest([a$, b$], (a, b) => a + b)`) */ +/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */ export function combineLatest( ...sourcesAndResultSelector: [...ObservableInputTuple, (...values: A) => R] ): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and combineLatestAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `combineLatestAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function combineLatest( ...sourcesAndScheduler: [...ObservableInputTuple, SchedulerLike] ): Observable; diff --git a/src/internal/observable/defer.ts b/src/internal/observable/defer.ts index 9b83b04aee..051142ccfa 100644 --- a/src/internal/observable/defer.ts +++ b/src/internal/observable/defer.ts @@ -41,7 +41,7 @@ import { innerFrom } from './from'; * * @see {@link Observable} * - * @param {function(): SubscribableOrPromise} observableFactory The Observable + * @param {function(): ObservableInput} observableFactory The Observable * factory function to invoke for each Observer that subscribes to the output * Observable. May also return a Promise, which will be converted on the fly * to an Observable. diff --git a/src/internal/observable/dom/WebSocketSubject.ts b/src/internal/observable/dom/WebSocketSubject.ts index f1e03f2f38..5109f4f5dd 100644 --- a/src/internal/observable/dom/WebSocketSubject.ts +++ b/src/internal/observable/dom/WebSocketSubject.ts @@ -104,7 +104,7 @@ export interface WebSocketSubjectConfig { url: string; /** The protocol to use to connect */ protocol?: string | Array; - /** @deprecated use {@link deserializer} */ + /** @deprecated Will be removed in v8. Use {@link deserializer} instead. */ resultSelector?: (e: MessageEvent) => T; /** * A serializer used to create messages from passed values before the @@ -187,6 +187,7 @@ export class WebSocketSubject extends AnonymousSubject { } } + /** @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ lift(operator: Operator): WebSocketSubject { const sock = new WebSocketSubject(this._config as WebSocketSubjectConfig, this.destination as any); sock.operator = operator; diff --git a/src/internal/observable/empty.ts b/src/internal/observable/empty.ts index 218b25db5e..14edd1a2b9 100644 --- a/src/internal/observable/empty.ts +++ b/src/internal/observable/empty.ts @@ -25,7 +25,7 @@ import { SchedulerLike } from '../types'; * // Complete! * ``` */ -export const EMPTY = new Observable(subscriber => subscriber.complete()); +export const EMPTY = new Observable((subscriber) => subscriber.complete()); /** * Creates an Observable that emits no items to the Observer and immediately @@ -82,12 +82,12 @@ export const EMPTY = new Observable(subscriber => subscriber.complete()); * the emission of the complete notification. * @return An "empty" Observable: emits only the complete * notification. - * @deprecated Deprecated in favor of using {@link EMPTY} constant, or {@link scheduled} (e.g. `scheduled([], scheduler)`) + * @deprecated Replaced with the {@link EMPTY} constant or {@link scheduled} (e.g. `scheduled([], scheduler)`). Will be removed in v8. */ export function empty(scheduler?: SchedulerLike) { return scheduler ? emptyScheduled(scheduler) : EMPTY; } function emptyScheduled(scheduler: SchedulerLike) { - return new Observable(subscriber => scheduler.schedule(() => subscriber.complete())); + return new Observable((subscriber) => scheduler.schedule(() => subscriber.complete())); } diff --git a/src/internal/observable/forkJoin.ts b/src/internal/observable/forkJoin.ts index d8d0e56242..db9a2b1b12 100644 --- a/src/internal/observable/forkJoin.ts +++ b/src/internal/observable/forkJoin.ts @@ -33,9 +33,9 @@ export function forkJoin( ): Observable; // forkJoin(a, b, c) -/** @deprecated Use the version that takes an array of Observables instead, Details https://rxjs.dev/deprecations/array-argument */ +/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */ export function forkJoin(...sources: [...ObservableInputTuple]): Observable; -/** @deprecated Use the version that takes an array of Observables instead, Details https://rxjs.dev/deprecations/array-argument */ +/** @deprecated Pass an array of sources instead. The rest-parameters signature will be removed in v8. Details: https://rxjs.dev/deprecations/array-argument */ export function forkJoin( ...sourcesAndResultSelector: [...ObservableInputTuple, (...values: A) => R] ): Observable; diff --git a/src/internal/observable/from.ts b/src/internal/observable/from.ts index ddf8a0809a..03fb1283d5 100644 --- a/src/internal/observable/from.ts +++ b/src/internal/observable/from.ts @@ -15,7 +15,7 @@ import { isIterable } from '../util/isIterable'; import { isReadableStreamLike, readableStreamLikeToAsyncGenerator } from '../util/isReadableStreamLike'; export function from>(input: O): Observable>; -/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function from>(input: O, scheduler: SchedulerLike): Observable>; /** diff --git a/src/internal/observable/fromEvent.ts b/src/internal/observable/fromEvent.ts index 7329c01dd2..a027664e06 100644 --- a/src/internal/observable/fromEvent.ts +++ b/src/internal/observable/fromEvent.ts @@ -79,7 +79,7 @@ export function fromEvent( ): Observable; export function fromEvent(target: NodeStyleEventEmitter | ArrayLike, eventName: string): Observable; -/** @deprecated type parameters that cannot be inferred will be removed in v8 */ +/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */ export function fromEvent(target: NodeStyleEventEmitter | ArrayLike, eventName: string): Observable; export function fromEvent( target: NodeStyleEventEmitter | ArrayLike, @@ -91,7 +91,7 @@ export function fromEvent( target: NodeCompatibleEventEmitter | ArrayLike, eventName: string ): Observable; -/** @deprecated type parameters that cannot be inferred will be removed in v8 */ +/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */ export function fromEvent(target: NodeCompatibleEventEmitter | ArrayLike, eventName: string): Observable; export function fromEvent( target: NodeCompatibleEventEmitter | ArrayLike, diff --git a/src/internal/observable/generate.ts b/src/internal/observable/generate.ts index e355d38a61..ed467e0703 100644 --- a/src/internal/observable/generate.ts +++ b/src/internal/observable/generate.ts @@ -86,7 +86,7 @@ export interface GenerateOptions extends GenerateBaseOptions { * @param {function (state: S): T} resultSelector Selector function for results produced in the sequence. (deprecated) * @param {SchedulerLike} [scheduler] A {@link SchedulerLike} on which to run the generator loop. If not provided, defaults to emit immediately. * @returns {Observable} The generated sequence. - * @deprecated Removing in v8. Use configuration object argument instead. + * @deprecated Instead of passing separate arguments, use the options argument. Signatures taking separate arguments will be removed in v8. */ export function generate( initialState: S, @@ -237,7 +237,7 @@ export function generate( * @param {function (state: S): T} [resultSelector] Selector function for results produced in the sequence. * @param {Scheduler} [scheduler] A {@link Scheduler} on which to run the generator loop. If not provided, defaults to emitting immediately. * @return {Observable} The generated sequence. - * @deprecated Removing in v8. Use configuration object argument instead. + * @deprecated Instead of passing separate arguments, use the options argument. Signatures taking separate arguments will be removed in v8. */ export function generate( initialState: S, diff --git a/src/internal/observable/merge.ts b/src/internal/observable/merge.ts index e4590fd435..4e3ce849f7 100644 --- a/src/internal/observable/merge.ts +++ b/src/internal/observable/merge.ts @@ -8,11 +8,11 @@ import { popNumber, popScheduler } from '../util/args'; export function merge(...sources: [...ObservableInputTuple]): Observable; export function merge(...sourcesAndConcurrency: [...ObservableInputTuple, number?]): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and mergeAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function merge( ...sourcesAndScheduler: [...ObservableInputTuple, SchedulerLike?] ): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled and mergeAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `mergeAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function merge( ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple, number?, SchedulerLike?] ): Observable; diff --git a/src/internal/observable/never.ts b/src/internal/observable/never.ts index 280ea4ed02..ead9ba1895 100644 --- a/src/internal/observable/never.ts +++ b/src/internal/observable/never.ts @@ -34,8 +34,8 @@ import { noop } from '../util/noop'; export const NEVER = new Observable(noop); /** - * @deprecated Deprecated in favor of using {@link NEVER} constant. + * @deprecated Replaced with the {@link NEVER} constant. Will be removed in v8. */ -export function never () { +export function never() { return NEVER; } diff --git a/src/internal/observable/of.ts b/src/internal/observable/of.ts index 24de743668..f9e0461800 100644 --- a/src/internal/observable/of.ts +++ b/src/internal/observable/of.ts @@ -12,13 +12,13 @@ import { popScheduler } from '../util/args'; export function of(value: null): Observable; export function of(value: undefined): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function of(scheduler: SchedulerLike): Observable; -/** @deprecated The scheduler argument is deprecated, use scheduled. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function of(...valuesAndScheduler: [...A, SchedulerLike]): Observable>; export function of(): Observable; -/** @deprecated remove in v8. Do not use generic arguments directly, allow inference or cast with `as` */ +/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */ export function of(): Observable; export function of(value: T): Observable; export function of(...values: A): Observable>; diff --git a/src/internal/observable/pairs.ts b/src/internal/observable/pairs.ts index 6d5140ce64..071879bce8 100644 --- a/src/internal/observable/pairs.ts +++ b/src/internal/observable/pairs.ts @@ -3,19 +3,19 @@ import { SchedulerLike } from '../types'; import { from } from './from'; /** - * @deprecated To be removed in version 8. Use `from(Object.entries(obj))` instead. + * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8. */ export function pairs(arr: readonly T[], scheduler?: SchedulerLike): Observable<[string, T]>; /** - * @deprecated To be removed in version 8. Use `from(Object.entries(obj))` instead. + * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8. */ export function pairs>(obj: O, scheduler?: SchedulerLike): Observable<[keyof O, O[keyof O]]>; /** - * @deprecated To be removed in version 8. Use `from(Object.entries(obj))` instead. + * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8. */ export function pairs(iterable: Iterable, scheduler?: SchedulerLike): Observable<[string, T]>; /** - * @deprecated To be removed in version 8. Use `from(Object.entries(obj))` instead. + * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8. */ export function pairs( n: number | bigint | boolean | ((...args: any[]) => any) | symbol, @@ -73,7 +73,7 @@ export function pairs( * when resulting Observable will emit values. * @returns {(Observable>)} An observable sequence of * [key, value] pairs from the object. - * @deprecated To be removed in version 8. Use `from(Object.entries(obj))` instead. + * @deprecated Use `from(Object.entries(obj))` instead. Will be removed in v8. */ export function pairs(obj: any, scheduler?: SchedulerLike) { return from(Object.entries(obj), scheduler as any); diff --git a/src/internal/observable/range.ts b/src/internal/observable/range.ts index 26ed6786e1..834e393932 100644 --- a/src/internal/observable/range.ts +++ b/src/internal/observable/range.ts @@ -5,7 +5,7 @@ import { EMPTY } from './empty'; export function range(start: number, count?: number): Observable; /** - * @deprecated To be removed in v8. Passing a scheduler is deprecated, use `range(start, count).pipe(observeOn(scheduler))` instead. + * @deprecated The `scheduler` parameter will be removed in v8. Use `range(start, count).pipe(observeOn(scheduler))` instead. Details: Details: https://rxjs.dev/deprecations/scheduler-argument */ export function range(start: number, count: number | undefined, scheduler: SchedulerLike): Observable; diff --git a/src/internal/observable/throwError.ts b/src/internal/observable/throwError.ts index 322dfdf9dd..426aa70d7d 100644 --- a/src/internal/observable/throwError.ts +++ b/src/internal/observable/throwError.ts @@ -103,7 +103,7 @@ export function throwError(errorFactory: () => any): Observable; * Returns an observable that will error with the specified error immediately upon subscription. * * @param error The error instance to emit - * @deprecated Removed in v8. Instead, pass a factory function to `throwError(() => new Error('test'))`. This is + * @deprecated Support for passing an error value will be removed in v8. Instead, pass a factory function to `throwError(() => new Error('test'))`. This is * because it will create the error at the moment it should be created and capture a more appropriate stack trace. If * for some reason you need to create the error ahead of time, you can still do that: `const err = new Error('test'); throwError(() => err);`. */ @@ -114,8 +114,9 @@ export function throwError(error: any): Observable; * * @param errorOrErrorFactory An error instance or error factory * @param scheduler A scheduler to use to schedule the error notification - * @deprecated Use `throwError` in combination with {@link observeOn}: - * `throwError(() => new Error('test')).pipe(observeOn(scheduler));` + * @deprecated The `scheduler` parameter will be removed in v8. + * Use `throwError` in combination with {@link observeOn}: `throwError(() => new Error('test')).pipe(observeOn(scheduler));`. + * Details: https://rxjs.dev/deprecations/scheduler-argument */ export function throwError(errorOrErrorFactory: any, scheduler: SchedulerLike): Observable; diff --git a/src/internal/observable/timer.ts b/src/internal/observable/timer.ts index 83be9c1de9..9eb12f0dd9 100644 --- a/src/internal/observable/timer.ts +++ b/src/internal/observable/timer.ts @@ -129,7 +129,7 @@ export function timer(due: number | Date, scheduler?: SchedulerLike): Observable export function timer(startDue: number | Date, intervalDuration: number, scheduler?: SchedulerLike): Observable; /** - * @deprecated Use `timer(dueTime, scheduler?)` instead. This call pattern will be removed in version 8. + * @deprecated The signature allowing `undefined` to be passed for `intervalDuration` will be removed in v8. Use the `timer(dueTime, scheduler?)` signature instead. */ export function timer(dueTime: number | Date, unused: undefined, scheduler?: SchedulerLike): Observable<0>; diff --git a/src/internal/operators/combineAll.ts b/src/internal/operators/combineAll.ts index f5ccd1dce5..c24157e08b 100644 --- a/src/internal/operators/combineAll.ts +++ b/src/internal/operators/combineAll.ts @@ -1,6 +1,6 @@ import { combineLatestAll } from './combineLatestAll'; /** - * @deprecated renamed. Use {@link combineLatestAll}. + * @deprecated Renamed to {@link combineLatestAll}. Will be removed in v8. */ export const combineAll = combineLatestAll; diff --git a/src/internal/operators/combineLatest.ts b/src/internal/operators/combineLatest.ts index a8358316c8..aa4e9ce7ab 100644 --- a/src/internal/operators/combineLatest.ts +++ b/src/internal/operators/combineLatest.ts @@ -6,23 +6,23 @@ import { mapOneOrManyArgs } from '../util/mapOneOrManyArgs'; import { pipe } from '../util/pipe'; import { popResultSelector } from '../util/args'; -/** @deprecated use {@link combineLatestWith} */ +/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ export function combineLatest( sources: [...ObservableInputTuple], project: (...values: [T, ...A]) => R ): OperatorFunction; -/** @deprecated use {@link combineLatestWith} */ +/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ export function combineLatest(sources: [...ObservableInputTuple]): OperatorFunction; -/** @deprecated use {@link combineLatestWith} */ +/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ export function combineLatest( ...sourcesAndProject: [...ObservableInputTuple, (...values: [T, ...A]) => R] ): OperatorFunction; -/** @deprecated use {@link combineLatestWith} */ +/** @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ export function combineLatest(...sources: [...ObservableInputTuple]): OperatorFunction; /** - * @deprecated Deprecated, use {@link combineLatestWith} or static {@link combineLatest} + * @deprecated Replaced with {@link combineLatestWith}. Will be removed in v8. */ export function combineLatest(...args: (ObservableInput | ((...values: any[]) => R))[]): OperatorFunction { const resultSelector = popResultSelector(args); diff --git a/src/internal/operators/concat.ts b/src/internal/operators/concat.ts index 992db82887..0aeb147198 100644 --- a/src/internal/operators/concat.ts +++ b/src/internal/operators/concat.ts @@ -4,15 +4,15 @@ import { concatAll } from './concatAll'; import { internalFromArray } from '../observable/fromArray'; import { popScheduler } from '../util/args'; -/** @deprecated remove in v8. Use {@link concatWith} */ +/** @deprecated Replaced with {@link concatWith}. Will be removed in v8. */ export function concat(...sources: [...ObservableInputTuple]): OperatorFunction; -/** @deprecated remove in v8. Use {@link concatWith} */ +/** @deprecated Replaced with {@link concatWith}. Will be removed in v8. */ export function concat( ...sourcesAndScheduler: [...ObservableInputTuple, SchedulerLike] ): OperatorFunction; /** - * @deprecated remove in v8. Use {@link concatWith} + * @deprecated Replaced with {@link concatWith}. Will be removed in v8. */ export function concat(...args: any[]): OperatorFunction { const scheduler = popScheduler(args); diff --git a/src/internal/operators/concatMap.ts b/src/internal/operators/concatMap.ts index 0c4c5702bf..7dfbac5bcf 100644 --- a/src/internal/operators/concatMap.ts +++ b/src/internal/operators/concatMap.ts @@ -6,12 +6,12 @@ import { isFunction } from '../util/isFunction'; export function concatMap>( project: (value: T, index: number) => O ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function concatMap>( project: (value: T, index: number) => O, resultSelector: undefined ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function concatMap>( project: (value: T, index: number) => O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R diff --git a/src/internal/operators/concatMapTo.ts b/src/internal/operators/concatMapTo.ts index e23b2cc36b..e0142721dc 100644 --- a/src/internal/operators/concatMapTo.ts +++ b/src/internal/operators/concatMapTo.ts @@ -4,12 +4,12 @@ import { isFunction } from '../util/isFunction'; /* tslint:disable:max-line-length */ export function concatMapTo>(observable: O): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function concatMapTo>( observable: O, resultSelector: undefined ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function concatMapTo>( observable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R diff --git a/src/internal/operators/delayWhen.ts b/src/internal/operators/delayWhen.ts index 3872169293..208438fffb 100644 --- a/src/internal/operators/delayWhen.ts +++ b/src/internal/operators/delayWhen.ts @@ -6,12 +6,7 @@ import { ignoreElements } from './ignoreElements'; import { mapTo } from './mapTo'; import { mergeMap } from './mergeMap'; -/** @deprecated In future versions, empty notifiers will no longer re-emit the source value on the output observable. */ -export function delayWhen( - delayDurationSelector: (value: T, index: number) => Observable, - subscriptionDelay?: Observable -): MonoTypeOperatorFunction; -/** @deprecated In future versions, `subscriptionDelay` will no longer be supported. */ +/** @deprecated The `subscriptionDelay` parameter will be removed in v8. */ export function delayWhen( delayDurationSelector: (value: T, index: number) => Observable, subscriptionDelay: Observable diff --git a/src/internal/operators/endWith.ts b/src/internal/operators/endWith.ts index 8ae46f2156..822be4c0b5 100644 --- a/src/internal/operators/endWith.ts +++ b/src/internal/operators/endWith.ts @@ -4,9 +4,9 @@ import { concat } from '../observable/concat'; import { of } from '../observable/of'; import { MonoTypeOperatorFunction, SchedulerLike, OperatorFunction, ValueFromArray } from '../types'; -/** @deprecated The scheduler argument is deprecated, use scheduled and concatAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @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 argument is deprecated, use scheduled and concatAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @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>; diff --git a/src/internal/operators/exhaust.ts b/src/internal/operators/exhaust.ts index bfc24ff110..a4410dbfdf 100644 --- a/src/internal/operators/exhaust.ts +++ b/src/internal/operators/exhaust.ts @@ -1,6 +1,6 @@ import { exhaustAll } from './exhaustAll'; /** - * @deprecated renamed. Use {@link exhaustAll}. + * @deprecated Renamed to {@link exhaustAll}. Will be removed in v8. */ export const exhaust = exhaustAll; diff --git a/src/internal/operators/exhaustMap.ts b/src/internal/operators/exhaustMap.ts index fe2532b284..6a91568be1 100644 --- a/src/internal/operators/exhaustMap.ts +++ b/src/internal/operators/exhaustMap.ts @@ -10,12 +10,12 @@ import { OperatorSubscriber } from './OperatorSubscriber'; export function exhaustMap>( project: (value: T, index: number) => O ): OperatorFunction>; -/** @deprecated resultSelector is no longer supported. Use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function exhaustMap>( project: (value: T, index: number) => O, resultSelector: undefined ): OperatorFunction>; -/** @deprecated resultSelector is no longer supported. Use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function exhaustMap( project: (value: T, index: number) => ObservableInput, resultSelector: (outerValue: T, innerValue: I, outerIndex: number, innerIndex: number) => R diff --git a/src/internal/operators/expand.ts b/src/internal/operators/expand.ts index 907164adbe..b79f6376e2 100644 --- a/src/internal/operators/expand.ts +++ b/src/internal/operators/expand.ts @@ -9,8 +9,9 @@ export function expand>( scheduler?: SchedulerLike ): OperatorFunction>; /** - * @deprecated Will be removed in v8. If you need to schedule the inner subscription, + * @deprecated The `scheduler` parameter will be removed in v8. If you need to schedule the inner subscription, * use `subscribeOn` within the projection function: `expand((value) => fn(value).pipe(subscribeOn(scheduler)))`. + * Details: Details: https://rxjs.dev/deprecations/scheduler-argument */ export function expand>( project: (value: T, index: number) => O, diff --git a/src/internal/operators/flatMap.ts b/src/internal/operators/flatMap.ts index 8ce64390bb..817917cd76 100644 --- a/src/internal/operators/flatMap.ts +++ b/src/internal/operators/flatMap.ts @@ -1,6 +1,6 @@ import { mergeMap } from './mergeMap'; /** - * @deprecated renamed. Use {@link mergeMap}. + * @deprecated Renamed to {@link mergeMap}. Will be removed in v8. */ export const flatMap = mergeMap; diff --git a/src/internal/operators/mapTo.ts b/src/internal/operators/mapTo.ts index 33c341dd5c..34c371ae93 100644 --- a/src/internal/operators/mapTo.ts +++ b/src/internal/operators/mapTo.ts @@ -3,7 +3,7 @@ import { operate } from '../util/lift'; import { OperatorSubscriber } from './OperatorSubscriber'; export function mapTo(value: R): OperatorFunction; -/** @deprecated remove in v8. Use mapTo(value: R): OperatorFunction signature instead **/ +/** @deprecated Do not specify explicit type parameters. Signatures with type parameters that cannot be inferred will be removed in v8. */ export function mapTo(value: R): OperatorFunction; /** diff --git a/src/internal/operators/materialize.ts b/src/internal/operators/materialize.ts index c713e367d8..70257b9bfe 100644 --- a/src/internal/operators/materialize.ts +++ b/src/internal/operators/materialize.ts @@ -52,10 +52,6 @@ import { OperatorSubscriber } from './OperatorSubscriber'; * @return A function that returns an Observable that emits * {@link Notification} objects that wrap the original emissions from the * source Observable with metadata. - * - * @deprecated In version 8, materialize will start to emit {@link ObservableNotification} objects, and not - * {@link Notification} instances. This means that methods that are not commonly used, like `Notification.observe` - * will not be available on the emitted values at that time. */ export function materialize(): OperatorFunction & ObservableNotification> { return operate((source, subscriber) => { diff --git a/src/internal/operators/merge.ts b/src/internal/operators/merge.ts index 7352c1d8e2..9e3e6c5721 100644 --- a/src/internal/operators/merge.ts +++ b/src/internal/operators/merge.ts @@ -5,17 +5,17 @@ import { internalFromArray } from '../observable/fromArray'; import { mergeAll } from './mergeAll'; import { popNumber, popScheduler } from '../util/args'; -/** @deprecated use {@link mergeWith} or static {@link merge} */ +/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge(...sources: [...ObservableInputTuple]): OperatorFunction; -/** @deprecated use {@link mergeWith} or static {@link merge} */ +/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndConcurrency: [...ObservableInputTuple, number] ): OperatorFunction; -/** @deprecated use {@link mergeWith} or static {@link merge} */ +/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndScheduler: [...ObservableInputTuple, SchedulerLike] ): OperatorFunction; -/** @deprecated use {@link mergeWith} or static {@link merge} */ +/** @deprecated Replaced with {@link mergeWith}. Will be removed in v8. */ export function merge( ...sourcesAndConcurrencyAndScheduler: [...ObservableInputTuple, number, SchedulerLike] ): OperatorFunction; diff --git a/src/internal/operators/mergeMap.ts b/src/internal/operators/mergeMap.ts index cb98fc025e..5863c3342f 100644 --- a/src/internal/operators/mergeMap.ts +++ b/src/internal/operators/mergeMap.ts @@ -10,13 +10,13 @@ export function mergeMap>( project: (value: T, index: number) => O, concurrent?: number ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function mergeMap>( project: (value: T, index: number) => O, resultSelector: undefined, concurrent?: number ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function mergeMap>( project: (value: T, index: number) => O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R, diff --git a/src/internal/operators/mergeMapTo.ts b/src/internal/operators/mergeMapTo.ts index 76d4e96c95..d22a0c718e 100644 --- a/src/internal/operators/mergeMapTo.ts +++ b/src/internal/operators/mergeMapTo.ts @@ -3,9 +3,16 @@ import { mergeMap } from './mergeMap'; import { isFunction } from '../util/isFunction'; /* tslint:disable:max-line-length */ -export function mergeMapTo>(innerObservable: O, concurrent?: number): OperatorFunction>; -/** @deprecated */ -export function mergeMapTo>(innerObservable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R, concurrent?: number): OperatorFunction; +export function mergeMapTo>( + innerObservable: O, + concurrent?: number +): OperatorFunction>; +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ +export function mergeMapTo>( + innerObservable: O, + resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R, + concurrent?: number +): OperatorFunction; /* tslint:enable:max-line-length */ /** diff --git a/src/internal/operators/multicast.ts b/src/internal/operators/multicast.ts index f831bcf536..f47c006efc 100644 --- a/src/internal/operators/multicast.ts +++ b/src/internal/operators/multicast.ts @@ -12,11 +12,11 @@ import { connect } from './connect'; * * @param subject The subject to multicast through. * @return A function that returns a {@link ConnectableObservable} - * @deprecated This will be removed in version 8. Please use the {@link connectable} creation - * function, which creates a connectable observable. If you were using the {@link refCount} operator - * on the result of the `multicast` operator, then use the {@link share} operator, which is now - * highly configurable. `multicast(subject), refCount()` is equivalent to + * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}. + * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead. + * `multicast(subject), refCount()` is equivalent to * `share({ connector: () => subject, resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function multicast(subject: Subject): UnaryFunction, ConnectableObservable>; @@ -28,8 +28,10 @@ export function multicast(subject: Subject): UnaryFunction, * @param subject The subject used to multicast. * @param selector A setup function to setup the multicast * @return A function that returns an observable that mirrors the observable returned by the selector. - * @deprecated To be removed in version 8. Please use the new {@link connect} operator. - * `multicast(subject, fn)` is equivalent to `connect({ connector: () => subject, setup: fn })`. + * @deprecated Will be removed in v8. Use the {@link connect} operator instead. + * `multicast(subject, selector)` is equivalent to + * `connect(selector, { connector: () => subject })`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function multicast>( subject: Subject, @@ -45,11 +47,11 @@ export function multicast>( * will cause the underlying subject to be "reset" on error, completion, or refCounted unsubscription of * the source. * @return A function that returns a {@link ConnectableObservable} - * @deprecated This will be removed in version 8. Please use the {@link connectable} creation - * function, which creates a connectable observable. If you were using the {@link refCount} operator - * on the result of the `multicast` operator, then use the {@link share} operator, which is now - * highly configurable. `multicast(() => new BehaviorSubject('test'))), refCount()` is equivalent to + * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}. + * If you're using {@link refCount} after `multicast`, use the {@link share} operator instead. + * `multicast(() => new BehaviorSubject('test')), refCount()` is equivalent to * `share({ connector: () => new BehaviorSubject('test') })`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function multicast(subjectFactory: () => Subject): UnaryFunction, ConnectableObservable>; @@ -61,8 +63,10 @@ export function multicast(subjectFactory: () => Subject): UnaryFunction>( subjectFactory: () => Subject, diff --git a/src/internal/operators/partition.ts b/src/internal/operators/partition.ts index b1d45abf8e..6fa9354cdd 100644 --- a/src/internal/operators/partition.ts +++ b/src/internal/operators/partition.ts @@ -47,12 +47,12 @@ import { UnaryFunction } from '../types'; * @return A function that returns an array with two Observables: one with * values that passed the predicate, and another with values that did not pass * the predicate. - * @deprecated use `partition` static creation function instead + * @deprecated Replaced with the `partition` static creation function. Will be removed in v8. */ -export function partition(predicate: (value: T, index: number) => boolean, - thisArg?: any): UnaryFunction, [Observable, Observable]> { - return (source: Observable) => [ - filter(predicate, thisArg)(source), - filter(not(predicate, thisArg))(source) - ] as [Observable, Observable]; +export function partition( + predicate: (value: T, index: number) => boolean, + thisArg?: any +): UnaryFunction, [Observable, Observable]> { + return (source: Observable) => + [filter(predicate, thisArg)(source), filter(not(predicate, thisArg))(source)] as [Observable, Observable]; } diff --git a/src/internal/operators/pluck.ts b/src/internal/operators/pluck.ts index a0a0cedece..aa1dc49a40 100644 --- a/src/internal/operators/pluck.ts +++ b/src/internal/operators/pluck.ts @@ -4,11 +4,43 @@ import { OperatorFunction } from '../types'; /* tslint:disable:max-line-length */ export function pluck(k1: K1): OperatorFunction; export function pluck(k1: K1, k2: K2): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3, k4: K4): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction; -export function pluck(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction; +export function pluck( + k1: K1, + k2: K2, + k3: K3 +): OperatorFunction; +export function pluck( + k1: K1, + k2: K2, + k3: K3, + k4: K4 +): OperatorFunction; +export function pluck< + T, + K1 extends keyof T, + K2 extends keyof T[K1], + K3 extends keyof T[K1][K2], + K4 extends keyof T[K1][K2][K3], + K5 extends keyof T[K1][K2][K3][K4] +>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5): OperatorFunction; +export function pluck< + T, + K1 extends keyof T, + K2 extends keyof T[K1], + K3 extends keyof T[K1][K2], + K4 extends keyof T[K1][K2][K3], + K5 extends keyof T[K1][K2][K3][K4], + K6 extends keyof T[K1][K2][K3][K4][K5] +>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6): OperatorFunction; +export function pluck< + T, + K1 extends keyof T, + K2 extends keyof T[K1], + K3 extends keyof T[K1][K2], + K4 extends keyof T[K1][K2][K3], + K5 extends keyof T[K1][K2][K3][K4], + K6 extends keyof T[K1][K2][K3][K4][K5] +>(k1: K1, k2: K2, k3: K3, k4: K4, k5: K5, k6: K6, ...rest: string[]): OperatorFunction; export function pluck(...properties: string[]): OperatorFunction; /* tslint:enable:max-line-length */ @@ -42,7 +74,7 @@ export function pluck(...properties: string[]): OperatorFunction; * value. * @return A function that returns an Observable of property values from the * source values. - * @deprecated Remove in v8. Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. + * @deprecated Use {@link map} and optional chaining: `pluck('foo', 'bar')` is `map(x => x?.foo?.bar)`. Will be removed in v8. */ export function pluck(...properties: Array): OperatorFunction { const length = properties.length; diff --git a/src/internal/operators/publish.ts b/src/internal/operators/publish.ts index ba796f6ad0..0c43ae7244 100644 --- a/src/internal/operators/publish.ts +++ b/src/internal/operators/publish.ts @@ -9,12 +9,13 @@ import { connect } from './connect'; * Returns a connectable observable that, when connected, will multicast * all values through a single underlying {@link Subject} instance. * - * @deprecated To be removed in version 8. If you're using `publish()` to get a connectable observable, - * please use the new {@link connectable} creation function. `source.pipe(publish())` is - * equivalent to `connectable(source, () => new Subject())`. If you're calling {@link refCount} on the result - * of `publish`, please use the updated {@link share} operator which is highly configurable. + * @deprecated Will be removed in v8. To create a connectable observable, use {@link connectable}. + * `source.pipe(publish())` is equivalent to + * `connectable(source, { connector: () => new Subject(), resetOnDisconnect: false })`. + * If you're using {@link refCount} after `publish`, use {@link share} operator instead. * `source.pipe(publish(), refCount())` is equivalent to * `source.pipe(share({ resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publish(): UnaryFunction, ConnectableObservable>; @@ -26,8 +27,9 @@ export function publish(): UnaryFunction, ConnectableObservable * * @param selector A function used to setup multicasting prior to automatic connection. * - * @deprecated To be removed in version 8. Use the new {@link connect} operator. - * If you're using `publish(fn)`, it is equivalent to `connect(fn)`. + * @deprecated Will be removed in v8. Use the {@link connect} operator instead. + * `publish(selector)` is equivalent to `connect(selector)`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publish>(selector: (shared: Observable) => O): OperatorFunction>; diff --git a/src/internal/operators/publishBehavior.ts b/src/internal/operators/publishBehavior.ts index d0a581b6b2..87ff0ec8dc 100644 --- a/src/internal/operators/publishBehavior.ts +++ b/src/internal/operators/publishBehavior.ts @@ -5,17 +5,19 @@ import { UnaryFunction } from '../types'; /** * Creates a {@link ConnectableObservable} that utilizes a {@link BehaviorSubject}. - * + * * @param initialValue The initial value passed to the {@link BehaviorSubject}. * @return A function that returns a {@link ConnectableObservable} - * @deprecated to be removed in version 8. If you want to get a connectable observable that uses a - * {@link BehaviorSubject} under the hood, please use {@link connectable}. `source.pipe(publishBehavior(initValue))` - * is equivalent to: `connectable(source, () => new BehaviorSubject(initValue))`. - * If you're using {@link refCount} after the call to `publishBehavior`, use the {@link share} operator, which is now - * highly configurable. `source.pipe(publishBehavior(initValue), refCount())` is equivalent to: + * @deprecated Will be removed in v8. To create a connectable observable that uses a + * {@link BehaviorSubject} under the hood, use {@link connectable}. + * `source.pipe(publishBehavior(initValue))` is equivalent to + * `connectable(source, { connector: () => new BehaviorSubject(initValue), resetOnDisconnect: false })`. + * If you're using {@link refCount} after `publishBehavior`, use the {@link share} operator instead. + * `source.pipe(publishBehavior(initValue), refCount())` is equivalent to * `source.pipe(share({ connector: () => new BehaviorSubject(initValue), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`. + * Details: https://rxjs.dev/deprecations/multicasting */ -export function publishBehavior(initialValue: T): UnaryFunction, ConnectableObservable> { +export function publishBehavior(initialValue: T): UnaryFunction, ConnectableObservable> { const subject = new BehaviorSubject(initialValue); // Note that this has *never* supported the selector function. return (source) => new ConnectableObservable(source, () => subject); diff --git a/src/internal/operators/publishLast.ts b/src/internal/operators/publishLast.ts index 0d65444103..13a6e57624 100644 --- a/src/internal/operators/publishLast.ts +++ b/src/internal/operators/publishLast.ts @@ -57,12 +57,14 @@ import { UnaryFunction } from '../types'; * * @return A function that returns an Observable that emits elements of a * sequence produced by multicasting the source sequence. - * @deprecated To be removed in version 8. If you're trying to create a connectable observable - * with an {@link AsyncSubject} under the hood, please use the new {@link connectable} creation function. - * `source.pipe(publishLast())` is equivalent to `connectable(source, () => new AsyncSubject())`. - * If you're using {@link refCount} on the result of `publishLast`, you can use the updated {@link share} - * operator, which is now highly configurable. `source.pipe(publishLast(), refCount())` - * is equivalent to `source.pipe(share({ connector: () => new AsyncSubject(), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`. + * @deprecated Will be removed in v8. To create a connectable observable with an + * {@link AsyncSubject} under the hood, use {@link connectable}. + * `source.pipe(publishLast())` is equivalent to + * `connectable(source, { connector: () => new AsyncSubject(), resetOnDisconnect: false })`. + * If you're using {@link refCount} after `publishLast`, use the {@link share} operator instead. + * `source.pipe(publishLast(), refCount())` is equivalent to + * `source.pipe(share({ connector: () => new AsyncSubject(), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false }))`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publishLast(): UnaryFunction, ConnectableObservable> { const subject = new AsyncSubject(); diff --git a/src/internal/operators/publishReplay.ts b/src/internal/operators/publishReplay.ts index 2a134ed4ac..7a60341c45 100644 --- a/src/internal/operators/publishReplay.ts +++ b/src/internal/operators/publishReplay.ts @@ -11,12 +11,14 @@ import { isFunction } from '../util/isFunction'; * @param bufferSize The buffer size for the underlying {@link ReplaySubject}. * @param windowTime The window time for the underlying {@link ReplaySubject}. * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}. - * @deprecated To be removed in version 8. Use the new {@link connectable} create method to create - * a connectable observable. `source.pipe(publishReplay(size, time, scheduler))` is equivalent to - * `connectable(source, () => new ReplaySubject(size, time, scheduler))`. - * If you're using this with {@link refCount}, then use the new {@link share} operator, - * which is now highly configurable. `publishReplay(size, time, scheduler), refCount()` - * is equivalent to `share({ connector: () => new ReplaySubject(size, time, scheduler) })`. + * @deprecated Will be removed in v8. To create a connectable observable that uses a + * {@link ReplaySubject} under the hood, use {@link connectable}. + * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to + * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`. + * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead. + * `publishReplay(size, time, scheduler), refCount()` is equivalent to + * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publishReplay( bufferSize?: number, @@ -36,9 +38,10 @@ export function publishReplay( * @param windowTime The window time for the underlying {@link ReplaySubject}. * @param selector A function used to setup the multicast. * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}. - * @deprecated To be removed in version 8. Use the new {@link connect} operator. - * `source.pipe(publishReplay(size, window, fn, scheduler))` is equivalent to - * `const subject = new ReplaySubject(size, window, scheduler), source.pipe(connect(fn, { connector: () => subject }))`. + * @deprecated Will be removed in v8. Use the {@link connect} operator instead. + * `source.pipe(publishReplay(size, window, selector, scheduler))` is equivalent to + * `source.pipe(connect(selector, { connector: () => new ReplaySubject(size, window, scheduler) }))`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publishReplay>( bufferSize: number | undefined, @@ -55,12 +58,14 @@ export function publishReplay>( * @param windowTime The window time for the underlying {@link ReplaySubject}. * @param selector Passing `undefined` here determines that this operator will return a {@link ConnectableObservable}. * @param timestampProvider The timestamp provider for the underlying {@link ReplaySubject}. - * @deprecated To be removed in version 8. Use the new {@link connectable} create method to create - * a connectable observable. `source.pipe(publishReplay(size, time, scheduler))` is equivalent to - * `connectable(source, () => new ReplaySubject(size, time, scheduler))`. - * If you're using this with {@link refCount}, then use the new {@link share} operator, - * which is now highly configurable. `publishReplay(size, time, scheduler), refCount()` - * is equivalent to `share({ connector: () => new ReplaySubject(size, time, scheduler) })`. + * @deprecated Will be removed in v8. To create a connectable observable that uses a + * {@link ReplaySubject} under the hood, use {@link connectable}. + * `source.pipe(publishReplay(size, time, scheduler))` is equivalent to + * `connectable(source, { connector: () => new ReplaySubject(size, time, scheduler), resetOnDisconnect: false })`. + * If you're using {@link refCount} after `publishReplay`, use the {@link share} operator instead. + * `publishReplay(size, time, scheduler), refCount()` is equivalent to + * `share({ connector: () => new ReplaySubject(size, time, scheduler), resetOnError: false, resetOnComplete: false, resetOnRefCountZero: false })`. + * Details: https://rxjs.dev/deprecations/multicasting */ export function publishReplay>( bufferSize: number | undefined, diff --git a/src/internal/operators/race.ts b/src/internal/operators/race.ts index a31e3649ee..efa8cd94cb 100644 --- a/src/internal/operators/race.ts +++ b/src/internal/operators/race.ts @@ -2,9 +2,9 @@ import { ObservableInputTuple, OperatorFunction } from '../types'; import { argsOrArgArray } from '../util/argsOrArgArray'; import { raceWith } from './raceWith'; -/** @deprecated Deprecated use {@link raceWith} */ +/** @deprecated Replaced with {@link raceWith}. Will be removed in v8. */ export function race(otherSources: [...ObservableInputTuple]): OperatorFunction; -/** @deprecated Deprecated use {@link raceWith} */ +/** @deprecated Replaced with {@link raceWith}. Will be removed in v8. */ export function race(...otherSources: [...ObservableInputTuple]): OperatorFunction; /** @@ -13,7 +13,7 @@ export function race(...otherSources: [...Obser * @param args Sources used to race for which Observable emits first. * @return A function that returns an Observable that mirrors the output of the * first Observable to emit an item. - * @deprecated Deprecated use {@link raceWith} + * @deprecated Replaced with {@link raceWith}. Will be removed in v8. */ export function race(...args: any[]): OperatorFunction { return raceWith(...argsOrArgArray(args)); diff --git a/src/internal/operators/refCount.ts b/src/internal/operators/refCount.ts index b955b82f41..2fab3f55f8 100644 --- a/src/internal/operators/refCount.ts +++ b/src/internal/operators/refCount.ts @@ -58,11 +58,10 @@ import { OperatorSubscriber } from './OperatorSubscriber'; * @see {@link ConnectableObservable} * @see {@link share} * @see {@link publish} - * @deprecated to be removed in version 8. Use the updated {@link share} operator, - * which now is highly configurable. How `share` is used will depend on the connectable - * observable you created just prior to the `refCount` operator. For examples on how - * to replace this, see documentation in {@link multicast}, {@link publish}, {@link publishReplay}, - * {@link publishBehavior}, {@link publishLast} or {@link ConnectableObservable}. + * @deprecated Replaced with the {@link share} operator. How `share` is used + * will depend on the connectable observable you created just prior to the + * `refCount` operator. + * Details: https://rxjs.dev/deprecations/multicasting */ export function refCount(): MonoTypeOperatorFunction { return operate((source, subscriber) => { diff --git a/src/internal/operators/sampleTime.ts b/src/internal/operators/sampleTime.ts index 85ffa32eb4..0a5dda2830 100644 --- a/src/internal/operators/sampleTime.ts +++ b/src/internal/operators/sampleTime.ts @@ -43,7 +43,6 @@ import { interval } from '../observable/interval'; * @return A function that returns an Observable that emits the results of * sampling the values emitted by the source Observable at the specified time * interval. - * @deprecated To be removed in v8. Use `sample(interval(period, scheduler?))`, it's the same thing. */ export function sampleTime(period: number, scheduler: SchedulerLike = asyncScheduler): MonoTypeOperatorFunction { return sample(interval(period, scheduler)); diff --git a/src/internal/operators/startWith.ts b/src/internal/operators/startWith.ts index 5f68aaaa74..b639a16f7f 100644 --- a/src/internal/operators/startWith.ts +++ b/src/internal/operators/startWith.ts @@ -11,7 +11,7 @@ import { operate } from '../util/lift'; export function startWith(value: null): OperatorFunction; export function startWith(value: undefined): OperatorFunction; -/** @deprecated The scheduler argument is deprecated, use scheduled and concatAll. Details: https://rxjs.dev/deprecations/scheduler-argument */ +/** @deprecated The `scheduler` parameter will be removed in v8. Use `scheduled` and `concatAll`. Details: https://rxjs.dev/deprecations/scheduler-argument */ export function startWith( ...valuesAndScheduler: [...A, SchedulerLike] ): OperatorFunction>; diff --git a/src/internal/operators/switchMap.ts b/src/internal/operators/switchMap.ts index 993916079e..8665fcbbda 100644 --- a/src/internal/operators/switchMap.ts +++ b/src/internal/operators/switchMap.ts @@ -8,12 +8,12 @@ import { OperatorSubscriber } from './OperatorSubscriber'; export function switchMap>( project: (value: T, index: number) => O ): OperatorFunction>; -/** @deprecated resultSelector is no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function switchMap>( project: (value: T, index: number) => O, resultSelector: undefined ): OperatorFunction>; -/** @deprecated resultSelector is no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function switchMap>( project: (value: T, index: number) => O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R diff --git a/src/internal/operators/switchMapTo.ts b/src/internal/operators/switchMapTo.ts index 215ca1288b..5025d4ce2b 100644 --- a/src/internal/operators/switchMapTo.ts +++ b/src/internal/operators/switchMapTo.ts @@ -4,12 +4,12 @@ import { isFunction } from '../util/isFunction'; /* tslint:disable:max-line-length */ export function switchMapTo>(observable: O): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function switchMapTo>( observable: O, resultSelector: undefined ): OperatorFunction>; -/** @deprecated resultSelector no longer supported, use inner map instead, Details https://rxjs.dev/deprecations/resultSelector */ +/** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function switchMapTo>( observable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R diff --git a/src/internal/operators/tap.ts b/src/internal/operators/tap.ts index 8a2342bf34..dba1531279 100644 --- a/src/internal/operators/tap.ts +++ b/src/internal/operators/tap.ts @@ -6,7 +6,7 @@ import { identity } from '../util/identity'; export function tap(observer?: Partial>): MonoTypeOperatorFunction; export function tap(next: (value: T) => void): MonoTypeOperatorFunction; -/** @deprecated Use an observer instead of a complete callback, Details: https://rxjs.dev/deprecations/subscribe-arguments */ +/** @deprecated Instead of passing separate callback arguments, use an observer argument. Signatures taking separate callback arguments will be removed in v8. Details: https://rxjs.dev/deprecations/subscribe-arguments */ export function tap( next?: ((value: T) => void) | null, error?: ((error: any) => void) | null, diff --git a/src/internal/operators/timeInterval.ts b/src/internal/operators/timeInterval.ts index 13b9693a07..fa616f3fba 100644 --- a/src/internal/operators/timeInterval.ts +++ b/src/internal/operators/timeInterval.ts @@ -68,9 +68,9 @@ export function timeInterval(scheduler: SchedulerLike = async): OperatorFunct // TODO(benlesh): make this an interface, export the interface, but not the implemented class, // there's no reason users should be manually creating this type. -/** - * @deprecated exposed API, use as interface only. - */ export class TimeInterval { + /** + * @deprecated Internal implementation detail, do not construct directly. Will be made an interface in v8. + */ constructor(public value: T, public interval: number) {} } diff --git a/src/internal/operators/timeoutWith.ts b/src/internal/operators/timeoutWith.ts index f51596754e..0870d8013a 100644 --- a/src/internal/operators/timeoutWith.ts +++ b/src/internal/operators/timeoutWith.ts @@ -15,7 +15,7 @@ import { timeout } from './timeout'; * @param dueBy The exact time, as a `Date`, at which the timeout will be triggered if the first value does not arrive. * @param switchTo The observable to switch to when timeout occurs. * @param scheduler The scheduler to use with time-related operations within this operator. Defaults to {@link asyncScheduler} - * @deprecated This will be removed in v8. Use the configuration object with {@link timeout} instead: `timeoutWith(someDate, a$, scheduler)` -> `timeout({ first: someDate, with: () => a$, scheduler })` + * @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(someDate, a$, scheduler)`, use the configuration object `timeout({ first: someDate, with: () => a$, scheduler })`. Will be removed in v8. */ export function timeoutWith(dueBy: Date, switchTo: ObservableInput, scheduler?: SchedulerLike): OperatorFunction; @@ -79,7 +79,7 @@ export function timeoutWith(dueBy: Date, switchTo: ObservableInput, sch * @return A function that returns an Observable that mirrors behaviour of the * source Observable, unless timeout happens when it starts emitting values * from the Observable passed as a second parameter. - * @deprecated This will be removed in v8. Use the configuration object with {@link timeout} instead: `timeoutWith(100, a$, scheduler)` -> `timeout({ each: 100, with: () => a$, scheduler })` + * @deprecated Replaced with {@link timeout}. Instead of `timeoutWith(100, a$, scheduler)`, use the configuration object `timeout({ each: 100, with: () => a$, scheduler })`. Will be removed in v8. */ export function timeoutWith(waitFor: number, switchTo: ObservableInput, scheduler?: SchedulerLike): OperatorFunction; diff --git a/src/internal/operators/zip.ts b/src/internal/operators/zip.ts index 95974aa524..4de1371db8 100644 --- a/src/internal/operators/zip.ts +++ b/src/internal/operators/zip.ts @@ -2,22 +2,22 @@ import { zip as zipStatic } from '../observable/zip'; import { ObservableInput, ObservableInputTuple, OperatorFunction, Cons } from '../types'; import { operate } from '../util/lift'; -/** @deprecated Deprecated use {@link zipWith} */ +/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */ export function zip(otherInputs: [...ObservableInputTuple]): OperatorFunction>; -/** @deprecated Deprecated use {@link zipWith} */ +/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */ export function zip( otherInputsAndProject: [...ObservableInputTuple], project: (...values: Cons) => R ): OperatorFunction; -/** @deprecated Deprecated use {@link zipWith} */ +/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */ export function zip(...otherInputs: [...ObservableInputTuple]): OperatorFunction>; -/** @deprecated Deprecated use {@link zipWith} */ +/** @deprecated Replaced with {@link zipWith}. Will be removed in v8. */ export function zip( ...otherInputsAndProject: [...ObservableInputTuple, (...values: Cons) => R] ): OperatorFunction; /** - * @deprecated Deprecated. Use {@link zipWith}. + * @deprecated Replaced with {@link zipWith}. Will be removed in v8. */ export function zip(...sources: Array | ((...values: Array) => R)>): OperatorFunction { return operate((source, subscriber) => { diff --git a/src/internal/scheduler/VirtualTimeScheduler.ts b/src/internal/scheduler/VirtualTimeScheduler.ts index d21760e001..34ce4552c3 100644 --- a/src/internal/scheduler/VirtualTimeScheduler.ts +++ b/src/internal/scheduler/VirtualTimeScheduler.ts @@ -4,8 +4,7 @@ import { AsyncScheduler } from './AsyncScheduler'; import { SchedulerAction } from '../types'; export class VirtualTimeScheduler extends AsyncScheduler { - - /** @deprecated remove in v8. `frameTimeFactor` is not used in VirtualTimeScheduler directly. */ + /** @deprecated Not used in VirtualTimeScheduler directly. Will be removed in v8. */ static frameTimeFactor = 10; /** @@ -18,7 +17,7 @@ export class VirtualTimeScheduler extends AsyncScheduler { /** * Used internally to examine the current virtual action index being processed. - * @deprecated remove in v8. Should be a private API. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ public index: number = -1; @@ -29,8 +28,7 @@ export class VirtualTimeScheduler extends AsyncScheduler { * @param schedulerActionCtor The type of Action to initialize when initializing actions during scheduling. * @param maxFrames The maximum number of frames to process before stopping. Used to prevent endless flush cycles. */ - constructor(schedulerActionCtor: typeof AsyncAction = VirtualAction as any, - public maxFrames: number = Infinity) { + constructor(schedulerActionCtor: typeof AsyncAction = VirtualAction as any, public maxFrames: number = Infinity) { super(schedulerActionCtor, () => this.frame); } @@ -40,8 +38,7 @@ export class VirtualTimeScheduler extends AsyncScheduler { * @return {void} */ public flush(): void { - - const {actions, maxFrames} = this; + const { actions, maxFrames } = this; let error: any; let action: AsyncAction | undefined; @@ -49,13 +46,13 @@ export class VirtualTimeScheduler extends AsyncScheduler { actions.shift(); this.frame = action.delay; - if (error = action.execute(action.state, action.delay)) { + if ((error = action.execute(action.state, action.delay))) { break; } } if (error) { - while (action = actions.shift()) { + while ((action = actions.shift())) { action.unsubscribe(); } throw error; @@ -64,12 +61,13 @@ export class VirtualTimeScheduler extends AsyncScheduler { } export class VirtualAction extends AsyncAction { - protected active: boolean = true; - constructor(protected scheduler: VirtualTimeScheduler, - protected work: (this: SchedulerAction, state?: T) => void, - protected index: number = scheduler.index += 1) { + constructor( + protected scheduler: VirtualTimeScheduler, + protected work: (this: SchedulerAction, state?: T) => void, + protected index: number = (scheduler.index += 1) + ) { super(scheduler, work); this.index = scheduler.index = index; } @@ -96,7 +94,7 @@ export class VirtualAction extends AsyncAction { protected requestAsyncId(scheduler: VirtualTimeScheduler, id?: any, delay: number = 0): any { this.delay = scheduler.frame + delay; - const {actions} = scheduler; + const { actions } = scheduler; actions.push(this); (actions as Array>).sort(VirtualAction.sortActions); return true; diff --git a/src/internal/scheduler/animationFrame.ts b/src/internal/scheduler/animationFrame.ts index 0b3bbd1100..2ce033df43 100644 --- a/src/internal/scheduler/animationFrame.ts +++ b/src/internal/scheduler/animationFrame.ts @@ -36,6 +36,6 @@ import { AnimationFrameScheduler } from './AnimationFrameScheduler'; export const animationFrameScheduler = new AnimationFrameScheduler(AnimationFrameAction); /** - * @deprecated renamed. Use {@link animationFrameScheduler}. + * @deprecated Renamed to {@link animationFrameScheduler}. Will be removed in v8. */ export const animationFrame = animationFrameScheduler; diff --git a/src/internal/scheduler/asap.ts b/src/internal/scheduler/asap.ts index 8931b2a598..5be1be4ea8 100644 --- a/src/internal/scheduler/asap.ts +++ b/src/internal/scheduler/asap.ts @@ -39,6 +39,6 @@ import { AsapScheduler } from './AsapScheduler'; export const asapScheduler = new AsapScheduler(AsapAction); /** - * @deprecated Renamed. Use {@link asapScheduler}. + * @deprecated Renamed to {@link asapScheduler}. Will be removed in v8. */ export const asap = asapScheduler; diff --git a/src/internal/scheduler/async.ts b/src/internal/scheduler/async.ts index 72605c43d5..76f9dc860d 100644 --- a/src/internal/scheduler/async.ts +++ b/src/internal/scheduler/async.ts @@ -51,6 +51,6 @@ import { AsyncScheduler } from './AsyncScheduler'; export const asyncScheduler = new AsyncScheduler(AsyncAction); /** - * @deprecated Renamed. Use {@link asyncScheduler}. + * @deprecated Renamed to {@link asyncScheduler}. Will be removed in v8. */ export const async = asyncScheduler; diff --git a/src/internal/scheduler/queue.ts b/src/internal/scheduler/queue.ts index ee801b2771..df4e2162cd 100644 --- a/src/internal/scheduler/queue.ts +++ b/src/internal/scheduler/queue.ts @@ -67,6 +67,6 @@ import { QueueScheduler } from './QueueScheduler'; export const queueScheduler = new QueueScheduler(QueueAction); /** - * @deprecated renamed. Use {@link queueScheduler}. + * @deprecated Renamed to {@link queueScheduler}. Will be removed in v8. */ export const queue = queueScheduler; diff --git a/src/internal/symbol/iterator.ts b/src/internal/symbol/iterator.ts index 8e9871a049..75098ef489 100644 --- a/src/internal/symbol/iterator.ts +++ b/src/internal/symbol/iterator.ts @@ -7,8 +7,3 @@ export function getSymbolIterator(): symbol { } export const iterator = getSymbolIterator(); - -/** - * @deprecated use {@link iterator} instead - */ -export const $$iterator = iterator; diff --git a/src/internal/testing/TestScheduler.ts b/src/internal/testing/TestScheduler.ts index 69c52ad61e..debb40b4cf 100644 --- a/src/internal/testing/TestScheduler.ts +++ b/src/internal/testing/TestScheduler.ts @@ -45,12 +45,12 @@ export class TestScheduler extends VirtualTimeScheduler { static frameTimeFactor = 10; /** - * @deprecated remove in v8. Not for public use. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ public readonly hotObservables: HotObservable[] = []; /** - * @deprecated remove in v8. Not for public use. + * @deprecated Internal implementation detail, do not use directly. Will be made internal in v8. */ public readonly coldObservables: ColdObservable[] = []; diff --git a/src/internal/types.ts b/src/internal/types.ts index 8b94b4f748..c0ba9637ed 100644 --- a/src/internal/types.ts +++ b/src/internal/types.ts @@ -73,7 +73,9 @@ export interface SubscriptionLike extends Unsubscribable { readonly closed: boolean; } -/** @deprecated To be removed in v8. Do not use. Most likely you want to use `ObservableInput` */ +/** + * @deprecated Do not use. Most likely you want to use `ObservableInput`. Will be removed in v8. + */ export type SubscribableOrPromise = Subscribable | Subscribable | PromiseLike | InteropObservable; /** OBSERVABLE INTERFACES */ @@ -94,7 +96,9 @@ export type ObservableInput = | Iterable | ReadableStreamLike; -/** @deprecated use {@link InteropObservable } */ +/** + * @deprecated Renamed to {@link InteropObservable }. Will be removed in v8. + */ export type ObservableLike = InteropObservable; /** @@ -213,7 +217,9 @@ export type ObservedValueOf = O extends ObservableInput ? T : never; */ export type ObservedValueUnionFromArray = X extends Array> ? T : never; -/** @deprecated use {@link ObservedValueUnionFromArray} */ +/** + * @deprecated Renamed to {@link ObservedValueUnionFromArray}. Will be removed in v8. + */ export type ObservedValuesFromArray = ObservedValueUnionFromArray; /**