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

Module has already exported a member named 'ServerStreamingMethodResult' #1002

Closed
arnidan opened this issue Feb 15, 2024 · 7 comments
Closed

Comments

@arnidan
Copy link
Contributor

arnidan commented Feb 15, 2024

When defining gRPC stream methods across two different services, the TypeScript compiler raises an error indicating that the module has already exported a member named 'ServerStreamingMethodResult'.

ts-proto version: 1.167.3
ts-proto params: outputServices=nice-grpc,useExactTypes=false,outputIndex=true,esModuleInterop=true,importSuffix=.js

Steps to Reproduce

  1. Define two different services, each with at least one server streaming method.
  2. Generate TypeScript code using ts-proto.
  3. Attempt to compile the generated TypeScript code.
@arnidan
Copy link
Contributor Author

arnidan commented Feb 15, 2024

@stephenh
Copy link
Owner

Hi @arnidan ; yeah, these conflicts are why I shied away from adding the outputIndex feature for awhile, it's just hard to anticipate what will/will not conflict.

I think there are probably a few approaches:

  1. If outputIndex=true, then remove the export from the ServerStreamingMethodResult, and export none of them
  2. The ts-poet Code datastructure technically knows all of it's export-d / defined symbols, so you could probably add some sort of generateBarrelExport([code1, code2, code3, ...]) utility method in ts-poet that generates export ... from ... statements but knows to only export the first symbol for each unique symbol name, and then alias the rest

Obviously 1 is a lot less work; but 2 is more robust as it'd handle all/future conflicts, and not just this one off.

If you'd like to submit a PR for either approach, that'd be great! Thanks!

@austin-liou
Copy link
Contributor

austin-liou commented Feb 16, 2024

I'm also running into this today :) I'll take a stab at a PR for option 1 because I'm super not confident in my ability to punch out option 2.

@stephenh
Copy link
Owner

This should be fixed by #1003 , thanks @austin-liou !

@austin-liou
Copy link
Contributor

@stephenh thanks! Can I ask when new releases get cut :)

@stephenh
Copy link
Owner

Ah yeah, usually releases are auto-published, but the fix: prefix got lost on the way into main (it was in the PR title but not the commit message); I amended the commit to add fix: back, which published it, and changed a setting in Github to prevent this going forward.

@austin-liou
Copy link
Contributor

Thanks!! Sorry about that - didn't quite know the convention

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

3 participants