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

Export generated Rpc interfaces #1115

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

marcaddeo
Copy link

This updates the generation of the Rpc interface to be publicly exported so consumers can define custom Rpc implementations.

Closes #1107

@@ -173,7 +173,7 @@ function generateGrpcWebRpcType(ctx: Context, returnObservable: boolean, hasStre
const { options } = ctx;
const { useAbortSignal } = options;

chunks.push(code`interface Rpc {`);
chunks.push(code`export interface Rpc {`);
Copy link
Owner

Choose a reason for hiding this comment

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

Hi @marcaddeo , thanks for the PR!

Can you update this to conditionally add the export, i.e. something like:

  const maybeExport = options.exportCommonSymbols ? "export" : "";

Because we have some users where, when working with multiple *.proto files, these common exports can import conflicts, so they can opt to turn off the export. Thanks!

Copy link
Author

Choose a reason for hiding this comment

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

Ah dang, that's true. I'm one of those people who opt out of the common exports too... So now this isn't going to help me at all 😅

Will update though.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh no! Sorry! :-)

Fwiw #1109 is an idea to make a shared ./ts-proto-types.ts type file that have all these common types, and be output all the time, in just one spot, in theory allowing us to kill the common exports problem.

If you're up for tackling a PR for that, that'd be amazing! 🙏

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.

interface Rpc not exported in service definition
2 participants