Is this implementation of endWith correct
See original GitHub issueBug Report
rxjs 6.5.1 implements endWith as follows:
export function endWith<T>(...array: Array<T | SchedulerLike>): MonoTypeOperatorFunction<T> {
  return (source: Observable<T>) => concat(source, ...(array as any[])) as Observable<T>;
}
Is this really correct given that concat expects observables as input, but array carries the individual items?
Issue Analytics
- State:
 - Created 4 years ago
 - Reactions:2
 - Comments:7 (1 by maintainers)
 
Top Results From Across the Web
How to implement a "EndsWith" on a string? - Stack Overflow
This will add a Java-like endsWith method to String: String.prototype. ... You can then do: "w,w,a,$,b,c".endsWith(s1) //true.
Read more >String endsWith Method Example in Java - Medium
This method returns true if the string is ending with given string or ... Internal implementation of endsWith method in Java String class....
Read more >String.prototype.endsWith() - JavaScript - MDN Web Docs
The endsWith() method determines whether a string ends with the characters of a specified string, returning true or false as appropriate.
Read more >Python String endswith() Method - Tutorialspoint
The python string endswith() method checks if the input string ends with the specified suffix. This function returns true if the string ends...
Read more >JavaScript String endsWith() Method - W3Schools
Definition and Usage. The endsWith() method returns true if a string ends with a specified string. Otherwise it returns false .
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

This is a really interesting bug. The tests pass because strings are iterable - so they are valid observable inputs. If the tests had used values other than strings, they would have failed!
@CarstenLeue Looks like a bug, to me. But the fix is a little more subtle, as the array could contain a
Scheduler. The array will need to be spread into a call toof, instead of being passed tofrom.