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

Make subscribe callbacks optional in typings #548

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1160,18 +1160,18 @@ The returned promise will fulfill after all the events have been consumed, or wi

#### `stream.subscribe(Observer) -> Subscription`

Draft ES Observable compatible subscribe. Start consuming events from `stream` by providing an [Observer object](https://github.com/zenparsing/es-observable#observer).
Draft ES Observable compatible subscribe. Start consuming events from `stream` by providing an [Observer object](https://github.com/zenparsing/es-observable#observer). All methods on `Observer` are optional.

<!-- skip-example -->
```js
type Observer = {
// Receives the next value in the sequence
next(value) => void
next?(value) => void
// Receives the sequence error
error(errorValue) => void
error?(errorValue) => void
// Receives the sequence completion signal
// The completionValue parameter is deprecated
complete(completionValue) => void
complete?(completionValue) => void
}
```

Expand Down
6 changes: 3 additions & 3 deletions type-definitions/most.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@ export interface Observable<A> {
}

export interface Subscriber<A> {
next(value: A): void;
error(err: Error): void;
next?(value: A): void;
error?(err: Error): void;
// complete value parameter is deprecated
complete(value?: A): void;
complete?(value?: A): void;
}

export interface Subscription<A> {
Expand Down