From a9c06f4e84b53fee06bf6492a187ce3acdc8acee Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Sun, 29 Jul 2018 08:44:03 +1000 Subject: [PATCH] fix(find): add undefined to return type --- src/internal/operators/find.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/internal/operators/find.ts b/src/internal/operators/find.ts index cbd2fcab38..2d6679af19 100644 --- a/src/internal/operators/find.ts +++ b/src/internal/operators/find.ts @@ -4,13 +4,9 @@ import {Subscriber} from '../Subscriber'; import {OperatorFunction, MonoTypeOperatorFunction} from '../types'; export function find(predicate: (value: T, index: number, source: Observable) => value is S, - thisArg?: any): OperatorFunction; -export function find(predicate: (value: T, index: number) => value is S, - thisArg?: any): OperatorFunction; + thisArg?: any): OperatorFunction; export function find(predicate: (value: T, index: number, source: Observable) => boolean, - thisArg?: any): MonoTypeOperatorFunction; -export function find(predicate: (value: T, index: number) => boolean, - thisArg?: any): MonoTypeOperatorFunction; + thisArg?: any): MonoTypeOperatorFunction; /** * Emits only the first value emitted by the source Observable that meets some * condition. @@ -48,14 +44,14 @@ export function find(predicate: (value: T, index: number) => boolean, * @owner Observable */ export function find(predicate: (value: T, index: number, source: Observable) => boolean, - thisArg?: any): MonoTypeOperatorFunction { + thisArg?: any): OperatorFunction { if (typeof predicate !== 'function') { throw new TypeError('predicate is not a function'); } - return (source: Observable) => source.lift(new FindValueOperator(predicate, source, false, thisArg)); + return (source: Observable) => source.lift(new FindValueOperator(predicate, source, false, thisArg)) as Observable; } -export class FindValueOperator implements Operator { +export class FindValueOperator implements Operator { constructor(private predicate: (value: T, index: number, source: Observable) => boolean, private source: Observable, private yieldIndex: boolean,