From 281449107d493eb79d23ad1c052b0ebd095caf01 Mon Sep 17 00:00:00 2001 From: Nicholas Jamieson Date: Sat, 3 Oct 2020 07:09:14 +1000 Subject: [PATCH] chore: use ObservableNotification type --- src/internal/Subscriber.ts | 7 ++----- src/internal/config.ts | 6 ++---- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/internal/Subscriber.ts b/src/internal/Subscriber.ts index ae70f97c28c..27c7bfb659d 100644 --- a/src/internal/Subscriber.ts +++ b/src/internal/Subscriber.ts @@ -1,6 +1,6 @@ /** @prettier */ import { isFunction } from './util/isFunction'; -import { Observer, PartialObserver } from './types'; +import { Observer, PartialObserver, ObservableNotification } from './types'; import { isSubscription, Subscription } from './Subscription'; import { config } from './config'; import { reportUnhandledError } from './util/reportUnhandledError'; @@ -199,10 +199,7 @@ function defaultErrorHandler(err: any) { * @param notification The notification being sent * @param subscriber The stopped subscriber */ -function handleStoppedNotification( - notification: { kind: 'N'; value: any } | { kind: 'E'; error: any } | { kind: 'C' }, - subscriber: Subscriber -) { +function handleStoppedNotification(notification: ObservableNotification, subscriber: Subscriber) { const { onStoppedNotification } = config; onStoppedNotification && timeoutProvider.setTimeout(() => onStoppedNotification(notification, subscriber)); } diff --git a/src/internal/config.ts b/src/internal/config.ts index 67c565b7683..9f4bacd2dce 100644 --- a/src/internal/config.ts +++ b/src/internal/config.ts @@ -1,6 +1,6 @@ /** @prettier */ - import { Subscriber } from './Subscriber'; +import { ObservableNotification } from './types'; /** * The global configuration object for RxJS, used to configure things @@ -28,9 +28,7 @@ export const config = { * we do not want errors thrown in this user-configured handler to interfere with the * behavior of the library. */ - onStoppedNotification: null as - | ((notification: { kind: 'N'; value: any } | { kind: 'E'; error: any } | { kind: 'C' }, subscriber: Subscriber) => void) - | null, + onStoppedNotification: null as ((notification: ObservableNotification, subscriber: Subscriber) => void) | null, /** * The promise constructor used by default for methods such as