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

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

Open
kaisellgren opened this issue Feb 28, 2025 · 0 comments
Open

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

kaisellgren opened this issue Feb 28, 2025 · 0 comments

Comments

@kaisellgren
Copy link

kaisellgren commented Feb 28, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant