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

grpc-js: stricter function check than instanceof #1761

Merged
merged 3 commits into from Apr 27, 2021

Conversation

zereraz
Copy link
Contributor

@zereraz zereraz commented Apr 21, 2021

instanceof Function does not work in vm context, related to #204 #795 and #1759

instanceof does not work in vm context
@@ -198,9 +198,9 @@ export class Client {
options: CallOptions;
callback: UnaryCallback<ResponseType>;
} {
if (arg1 instanceof Function) {
if (Object.prototype.toString.call(arg1) === '[object Function]') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you extract this condition into an isFunction function?

Copy link
Contributor Author

@zereraz zereraz Apr 24, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

have updated in the latest commit

@murgatroid99 murgatroid99 changed the base branch from master to @grpc/grpc-js@1.3.x April 27, 2021 17:24
@murgatroid99
Copy link
Member

murgatroid99 commented Apr 27, 2021

It looks like this doesn't compile. The test log is here: https://source.cloud.google.com/results/invocations/f8f4ecea-d9b2-4d70-8893-604b5a7f30b0/targets/grpc%2Fnode%2Fpull_request%2Flinux/log. Can you fix that?

It might help to make the return value of isFunction something like arg is UnaryCallback<ResponseType> or arg is Function.

Copy link
Member

@murgatroid99 murgatroid99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution.

@murgatroid99 murgatroid99 merged commit d82b1a3 into grpc:@grpc/grpc-js@1.3.x Apr 27, 2021
@murgatroid99
Copy link
Member

This fix is now out in version 1.3.1.

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

Successfully merging this pull request may close these issues.

None yet

3 participants