-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix(isArrayLike): reject functions because functions have "length" #3562
Conversation
spec/observables/from-spec.ts
Outdated
// for the purpose of making a nice diagram, spread out the synchronous emissions | ||
.concatMap((x, i) => of(x).delay(i === 0 ? 0 : 20, rxTestScheduler)); | ||
const expected = 'x-y-(z|)'; | ||
expectObservable(e1).toBe(expected, { x: 10, y: 20, z: 30 }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we undo the formatting changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
@@ -118,5 +119,26 @@ describe('from', () => { | |||
); | |||
expect(nextInvoked).to.equal(false); | |||
}); | |||
it(`should accept a function`, (done) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
from
should not accept a function.
from((...args) => subject.next(...args))
should not work and should error.
The change to isArrayLike
I can understand, I'm uncertain about this test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if from
accepts a Promise
, shouldn't it be able to accept a handler
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, the function has Symbol.observable
on it. I missed that. Apologies.
Thanks @johnlindquist <3 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description:
Added a
typeof x !== "function"
check toisArrayLike
.isArrayLike
was only checking forlength
and functions have alength
property. This prevented functions from properly falling through to this case:rxjs/src/internal/util/subscribeTo.ts
Line 31 in 6fd1fd7