diff --git a/spec-dtslint/operators/concatMapTo-spec.ts b/spec-dtslint/operators/concatMapTo-spec.ts index 7c7e297e75..d7836db94a 100644 --- a/spec-dtslint/operators/concatMapTo-spec.ts +++ b/spec-dtslint/operators/concatMapTo-spec.ts @@ -63,3 +63,7 @@ it('should enforce the return type', () => { it('should produce `Observable` when mapping to an `ObservableInput`', () => { const o = of(1, 2, 3).pipe(concatMapTo(Promise.reject())); // $ExpectType Observable }); + +it('should be deprecated', () => { + const o = of(1, 2, 3).pipe(concatMapTo(of(true))); // $ExpectDeprecation +}); \ No newline at end of file diff --git a/spec-dtslint/operators/mapTo-spec.ts b/spec-dtslint/operators/mapTo-spec.ts index 73d51e3ed9..c01b2c5fef 100644 --- a/spec-dtslint/operators/mapTo-spec.ts +++ b/spec-dtslint/operators/mapTo-spec.ts @@ -12,3 +12,7 @@ it('should infer correctly when returning a different type', () => { it('should enforce types', () => { const o = of(1, 2, 3).pipe(mapTo()); // $ExpectError }); + +it('should be deprecated', () => { + const o = of(1, 2, 3).pipe(mapTo(true)); // $ExpectDeprecation +}); \ No newline at end of file diff --git a/spec-dtslint/operators/mergeMapTo-spec.ts b/spec-dtslint/operators/mergeMapTo-spec.ts index 5d8c7f8af5..40af2280e0 100644 --- a/spec-dtslint/operators/mergeMapTo-spec.ts +++ b/spec-dtslint/operators/mergeMapTo-spec.ts @@ -75,3 +75,7 @@ it('should enforce types of the concurrent parameter with a resultSelector', () it('should produce `Observable` when mapping to an `ObservableInput`', () => { const o = of(1, 2, 3).pipe(mergeMapTo(Promise.reject())); // $ExpectType Observable }); + +it('should be deprecated', () => { + const o = of(1, 2, 3).pipe(mergeMapTo(of(true))); // $ExpectDeprecation +}); \ No newline at end of file diff --git a/spec-dtslint/operators/switchMapTo-spec.ts b/spec-dtslint/operators/switchMapTo-spec.ts index 6b4c8439e6..7611ee6654 100644 --- a/spec-dtslint/operators/switchMapTo-spec.ts +++ b/spec-dtslint/operators/switchMapTo-spec.ts @@ -58,3 +58,7 @@ it('should enforce the return type', () => { it('should produce `Observable` when mapping to an `ObservableInput`', () => { const o = of(1, 2, 3).pipe(switchMapTo(Promise.reject())); // $ExpectType Observable }); + +it('should be deprecated', () => { + const o = of(1, 2, 3).pipe(switchMapTo(of(true))); // $ExpectDeprecation +}); \ No newline at end of file diff --git a/src/internal/operators/concatMapTo.ts b/src/internal/operators/concatMapTo.ts index b7503c3b9f..00798c67c1 100644 --- a/src/internal/operators/concatMapTo.ts +++ b/src/internal/operators/concatMapTo.ts @@ -2,7 +2,7 @@ import { concatMap } from './concatMap'; import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types'; import { isFunction } from '../util/isFunction'; -/* tslint:disable:max-line-length */ +/** @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */ export function concatMapTo>(observable: O): OperatorFunction>; /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function concatMapTo>( @@ -14,7 +14,6 @@ export function concatMapTo>( observable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R ): OperatorFunction; -/* tslint:enable:max-line-length */ /** * Projects each source value to the same Observable which is merged multiple @@ -70,6 +69,7 @@ export function concatMapTo>( * @return A function that returns an Observable of values merged together by * joining the passed Observable with itself, one after the other, for each * value emitted from the source. + * @deprecated Will be removed in v9. Use {@link concatMap} instead: `concatMap(() => result)` */ export function concatMapTo>( innerObservable: O, diff --git a/src/internal/operators/mapTo.ts b/src/internal/operators/mapTo.ts index 1caab7eac3..e55f26c403 100644 --- a/src/internal/operators/mapTo.ts +++ b/src/internal/operators/mapTo.ts @@ -36,6 +36,7 @@ export function mapTo(value: R): OperatorFunction; * @param value The value to map each source value to. * @return A function that returns an Observable that emits the given `value` * every time the source Observable emits. + * @deprecated To be removed in v9. Use {@link map} instead: `map(() => value)`. */ export function mapTo(value: R): OperatorFunction { return map(() => value); diff --git a/src/internal/operators/switchMapTo.ts b/src/internal/operators/switchMapTo.ts index 1436204f70..252e72660a 100644 --- a/src/internal/operators/switchMapTo.ts +++ b/src/internal/operators/switchMapTo.ts @@ -2,7 +2,7 @@ import { switchMap } from './switchMap'; import { ObservableInput, OperatorFunction, ObservedValueOf } from '../types'; import { isFunction } from '../util/isFunction'; -/* tslint:disable:max-line-length */ +/** @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */ export function switchMapTo>(observable: O): OperatorFunction>; /** @deprecated The `resultSelector` parameter will be removed in v8. Use an inner `map` instead. Details: https://rxjs.dev/deprecations/resultSelector */ export function switchMapTo>( @@ -14,7 +14,6 @@ export function switchMapTo>( observable: O, resultSelector: (outerValue: T, innerValue: ObservedValueOf, outerIndex: number, innerIndex: number) => R ): OperatorFunction; -/* tslint:enable:max-line-length */ /** * Projects each source value to the same Observable which is flattened multiple @@ -55,6 +54,7 @@ export function switchMapTo>( * `resultSelector`) every time a value is emitted on the source Observable, * and taking only the values from the most recently projected inner * Observable. + * @deprecated Will be removed in v9. Use {@link mergeMap} instead: `mergeMap(() => result)` */ export function switchMapTo>( innerObservable: O,