Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: subscription closed does not comply with proposal #151

Merged
merged 3 commits into from
Mar 18, 2023
Merged
Show file tree
Hide file tree
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: 5 additions & 0 deletions .changeset/five-rules-bow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'wonka': patch
---

Make `closed: boolean` on `ObservableSubscription`s a required field to comply with the Observable proposal's type spec.
4 changes: 2 additions & 2 deletions src/observable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ interface ObservableSubscription {
*
* @readonly
*/
closed?: boolean;
closed: boolean;
/** Cancels the subscription.
* @remarks
* This cancels the ongoing subscription and the {@link ObservableObserver}'s callbacks will
Expand Down Expand Up @@ -76,7 +76,7 @@ interface ObservableLike<T> {
* @see {@link ObservableObserver} for the callbacks in an object that are called as Observables
* issue events.
*/
subscribe(observer: ObservableObserver<T>): ObservableSubscription;
subscribe(observer: ObservableObserver<T>): { unsubscribe(): void };

/** The well-known symbol specifying the default ES Observable for an object. */
[Symbol.observable]?(): Observable<T>;
Expand Down