Skip to content

Commit

Permalink
Add ObservableLike type
Browse files Browse the repository at this point in the history
  • Loading branch information
bigslycat committed Oct 19, 2018
1 parent 53c33ec commit d3eb0fd
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/es-observable/src/types.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@ export interface ObservableInterface<+T> {
((observer: ObserverInterface<T>) => SubscriptionInterface<T>);
}

export type ObservableLike<T> = {
+subscribe: ((
next: (T) => void,
error?: (Error) => void,
complete?: () => void,
) => { unsubscribe(): void }) &
((observer: ObserverLike<T>) => { unsubscribe(): void }),
};

export interface ObserverInterface<T> {
+start?: void | ((subscription: SubscriptionInterface<T>) => void);
+next?: void | ((value: T) => void);
Expand Down

0 comments on commit d3eb0fd

Please sign in to comment.