Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ export class Observable<T> implements Subscribable<T> {
}

return new PromiseCtor<void>((resolve, reject) => {
const subscription = this.subscribe((value) => {
// Must be declared in a separate statement to avoid a RefernceError when
// accessing subscription below in the closure due to Temporal Dead Zone.
let subscription: Subscription;
subscription = this.subscribe((value) => {
if (subscription) {
// if there is a subscription, then we can surmise
// the next handling is asynchronous. Any errors thrown
Expand Down