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

Make instanceof check optional #2865

Open
lionello opened this issue Dec 7, 2024 · 0 comments
Open

Make instanceof check optional #2865

lionello opened this issue Dec 7, 2024 · 0 comments

Comments

@lionello
Copy link

lionello commented Dec 7, 2024

Is your feature request related to a problem? Please describe.

We were renaming some of our Protobuf messages to conform to the naming guidelines, ie. FooRequest and FooResponse, but it broke dependent libraries, even though we had included duplicate message declarations with the old names. This was because the generated JavaScript code checks the instance of the message that gets passed in:

https://github.com/grpc/grpc-node/blob/master/packages/grpc-tools/src/node_generator.cc#L132-L137

I understand why that check was added, and it makes a lot of sense in JavaScript. For us, we use protoc-gen-ts to give us type-checking at build time, so the check just gets in the way of migrating to the correct message names, since protobuf and gRPC don't actually care about the message names.

Describe the solution you'd like

For ease of migration, I wish there was a way to omit the instanceof check in the generated JS code. Perhaps an additional flag: when the flag is set, the relevant lines get omitted from the generated code.

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