Skip to content

Question: Interface with _at least one_ defined member? #6806

Closed
@benlesh

Description

@benlesh

In RxJS, we have a need for an interface that is basically this:

interface Observer<T> {
  next?: (value: T) => void;
  error?: (err: any) => void;
  complete?: () => void;
}

but you'll notice that it matches {} in that case, which isn't what we want. What we really want is at least one of those members.

It seems like I'd be able to do something with PartialObserver<T> = NextObserver<T>|ErrorObserver|CompleteObserver, but I'm honestly not sure how to accomplish this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions