Skip to content

Commit

Permalink
refactor(mapTo): update function signature (#5102)
Browse files Browse the repository at this point in the history
Reduce the number of generics used in the 'mapTo' function to 1 generic parameter. Mark the 2 generic variant as a deprecated variant

Fixes #5090
  • Loading branch information
alaboudi authored and benlesh committed Jan 22, 2020
1 parent faaae75 commit 1e7d469
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/internal/operators/mapTo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import { Subscriber } from '../Subscriber';
import { Observable } from '../Observable';
import { OperatorFunction } from '../types';

export function mapTo<R>(value: R): OperatorFunction<any, R>;
/** @deprecated remove in v8. Use mapTo<R>(value: R): OperatorFunction<any, R> signature instead **/
export function mapTo<T, R>(value: R): OperatorFunction<T, R>;

/**
* Emits the given constant value on the output Observable every time the source
* Observable emits a value.
Expand Down Expand Up @@ -35,8 +39,8 @@ import { OperatorFunction } from '../types';
* @method mapTo
* @owner Observable
*/
export function mapTo<T, R>(value: R): OperatorFunction<T, R> {
return (source: Observable<T>) => source.lift(new MapToOperator(value));
export function mapTo<R>(value: R): OperatorFunction<any, R> {
return (source: Observable<any>) => source.lift(new MapToOperator(value));
}

class MapToOperator<T, R> implements Operator<T, R> {
Expand Down

0 comments on commit 1e7d469

Please sign in to comment.