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
Conversation
instanceof does not work in vm context
packages/grpc-js/src/client.ts
Outdated
@@ -198,9 +198,9 @@ export class Client { | |||
options: CallOptions; | |||
callback: UnaryCallback<ResponseType>; | |||
} { | |||
if (arg1 instanceof Function) { | |||
if (Object.prototype.toString.call(arg1) === '[object Function]') { |
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 you extract this condition into an isFunction
function?
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.
have updated in the latest commit
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 |
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.
Thank you for your contribution.
This fix is now out in version 1.3.1. |
instanceof Function
does not work in vm context, related to #204 #795 and #1759