From 15a7d42be9dd062ee6d15801f92eca2c682dc736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mladen=20Jakovljevi=C4=87?= Date: Mon, 28 Sep 2020 10:48:31 +0200 Subject: [PATCH] docs(operators): fix @return docs after #5729 merge --- src/internal/operators/dematerialize.ts | 2 +- src/internal/operators/materialize.ts | 6 ++-- src/internal/operators/onErrorResumeNext.ts | 8 ++--- src/internal/operators/publishBehavior.ts | 2 +- src/internal/operators/raceWith.ts | 2 +- src/internal/operators/take.ts | 2 +- src/internal/operators/timeout.ts | 39 ++++++++++----------- src/internal/operators/withLatestFrom.ts | 2 +- 8 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/internal/operators/dematerialize.ts b/src/internal/operators/dematerialize.ts index dc71969e7d..3a5c049f86 100644 --- a/src/internal/operators/dematerialize.ts +++ b/src/internal/operators/dematerialize.ts @@ -48,7 +48,7 @@ import { OperatorSubscriber } from './OperatorSubscriber'; * ``` * @see {@link materialize} * - * @return {OperatorFunction, T>} A function that returns an + * @return {OperatorFunction>} A function that returns an * Observable that emits items and notifications embedded in Notification * objects emitted by the source Observable. */ diff --git a/src/internal/operators/materialize.ts b/src/internal/operators/materialize.ts index 69684f05af..baf8e8a73b 100644 --- a/src/internal/operators/materialize.ts +++ b/src/internal/operators/materialize.ts @@ -50,9 +50,9 @@ import { OperatorSubscriber } from './OperatorSubscriber'; * @see {@link Notification} * @see {@link dematerialize} * - * @return {OperatorFunction>} A function that returns an - * Observable that emits {@link Notification} objects that wrap the original - * emissions from the source Observable with metadata. + * @return {OperatorFunction & ObservableNotification>} 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` diff --git a/src/internal/operators/onErrorResumeNext.ts b/src/internal/operators/onErrorResumeNext.ts index 6b7f6f66ab..1bcd0307e1 100644 --- a/src/internal/operators/onErrorResumeNext.ts +++ b/src/internal/operators/onErrorResumeNext.ts @@ -75,10 +75,10 @@ export function onErrorResumeNext[]>( * @see {@link concat} * @see {@link catchError} * - * @param {...ObservableInput} observables Observables passed either directly or as an array. - * @return {OperatorFunction} A function that returns an Observable that - * emits values from source Observable, but - if it errors - subscribes to the - * next passed Observable and so on, until it completes or runs out of + * @param {...ObservableInput} nextSources Observables passed either directly or as an array. + * @return {OperatorFunction} A function that returns an Observable + * that emits values from source Observable, but - if it errors - subscribes to + * the next passed Observable and so on, until it completes or runs out of * Observables. * @name onErrorResumeNext */ diff --git a/src/internal/operators/publishBehavior.ts b/src/internal/operators/publishBehavior.ts index 8cb11dc48f..19dc60a146 100644 --- a/src/internal/operators/publishBehavior.ts +++ b/src/internal/operators/publishBehavior.ts @@ -9,6 +9,6 @@ import { UnaryFunction } from '../types'; * @return {UnaryFunction, ConnectableObservable>} * @name publishBehavior */ -export function publishBehavior(value: T): UnaryFunction, ConnectableObservable> { +export function publishBehavior(value: T): UnaryFunction, ConnectableObservable> { return (source: Observable) => multicast(new BehaviorSubject(value))(source) as ConnectableObservable; } diff --git a/src/internal/operators/raceWith.ts b/src/internal/operators/raceWith.ts index 562b01f94f..17d6618592 100644 --- a/src/internal/operators/raceWith.ts +++ b/src/internal/operators/raceWith.ts @@ -20,7 +20,7 @@ export function race(...observables: Array | Array} A function that returns an Observable + * @return {OperatorFunction} A function that returns an Observable * that mirrors the output of the first Observable to emit an item. * @name race * @deprecated Deprecated use {@link raceWith} diff --git a/src/internal/operators/take.ts b/src/internal/operators/take.ts index c6b0c98c4a..101657ed18 100644 --- a/src/internal/operators/take.ts +++ b/src/internal/operators/take.ts @@ -43,7 +43,7 @@ import { OperatorSubscriber } from './OperatorSubscriber'; * @throws {ArgumentOutOfRangeError} When using `take(i)`, it delivers an * ArgumentOutOrRangeError to the Observer's `error` callback if `i < 0`. * - * @param {number} count The maximum number of `next` values to emit. + * @param count The maximum number of `next` values to emit. * @return {MonoTypeOperatorFunction} A function that returns an Observable * that emits only the first `count` values emitted by the source Observable, * or all of the values from the source if the source emits fewer than `count` diff --git a/src/internal/operators/timeout.ts b/src/internal/operators/timeout.ts index 0abccf60d9..27de0e56dd 100644 --- a/src/internal/operators/timeout.ts +++ b/src/internal/operators/timeout.ts @@ -301,10 +301,6 @@ export function timeout(each: number, scheduler?: SchedulerLike): MonoTypeOpe * * ![](timeout.png) * - * @param config Number specifying period within which Observable must emit - * values or Date specifying before when Observable should complete - * @param schedulerArg Scheduler controlling when timeout checks occur. - * * @return {MonoTypeOperatorFunction} A function that returns an Observable * that mirrors behaviour of the source Observable, unless timeout happens when * it throws an error. @@ -366,25 +362,26 @@ export function timeout(config: number | Date | TimeoutConfig, new OperatorSubscriber( subscriber, (value: T) => { - // clear the timer so we can emit and start another one. - timerSubscription?.unsubscribe(); - seen++; - // Emit - subscriber.next((lastValue = value)); - // null | undefined are both < 0. Thanks, JavaScript. - each! > 0 && startTimer(each!); - }, - undefined, - undefined, - () => { - if (!timerSubscription?.closed) { + // clear the timer so we can emit and start another one. timerSubscription?.unsubscribe(); + seen++; + // Emit + subscriber.next((lastValue = value)); + // null | undefined are both < 0. Thanks, JavaScript. + each! > 0 && startTimer(each!); + }, + undefined, + undefined, + () => { + if (!timerSubscription?.closed) { + timerSubscription?.unsubscribe(); + } + // Be sure not to hold the last value in memory after unsubscription + // it could be quite large. + lastValue = null; } - // Be sure not to hold the last value in memory after unsubscription - // it could be quite large. - lastValue = null; - } - ) + ) + ); // Intentionally terse code. diff --git a/src/internal/operators/withLatestFrom.ts b/src/internal/operators/withLatestFrom.ts index 16419d6507..9b57899744 100644 --- a/src/internal/operators/withLatestFrom.ts +++ b/src/internal/operators/withLatestFrom.ts @@ -141,7 +141,7 @@ export function withLatestFrom(array: ObservableInput[], project: (.. * first parameter is a value from the source Observable. (e.g. * `a.pipe(withLatestFrom(b, c), map(([a1, b1, c1]) => a1 + b1 + c1))`). If this is not * passed, arrays will be emitted on the output Observable. - * @return {OperatorFunction} A function that returns an Observable of + * @return {OperatorFunction} A function that returns an Observable of * projected values from the most recent values from each input Observable, or * an array of the most recent values from each input Observable. * @name withLatestFrom