Skip to content

Observable.or() type does not match its implementation #813

@kaisellgren

Description

@kaisellgren

I noticed that the type for or() method does not match its implentation:

https://github.com/baconjs/bacon.js/blob/master/src/observable.ts#L1138

or(other: Property<any>): Property<boolean>

If the value of this is falsy, then the method returns a property with whatever is passed into or(). This means, Property<boolean> type is not correct -- the value could be anything.

const value: Property<boolean> = constant(false).or(constant('foo'))

The above code type checks, but the value actually contains a string value.

I believe the or() method's argument should be of type Property<boolean> instead of Property<any>. Alternatively, the implementation has to change to coerce the value into a boolean.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions