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

Import declaration conflicts with local declaration with opts "outputJsonMethods=false,outputEncodeMethods=false" #298

Closed
doochik opened this issue May 18, 2021 · 1 comment · Fixed by #300
Labels

Comments

@doochik
Copy link
Collaborator

doochik commented May 18, 2021

This bug is similar to #36

My env

$ protoc --version
libprotoc 3.15.6
$ yarn --version
1.22.10
$ node --version
v14.17.0

Steps to reproduce

  1. Checkout latest tag (v1.80.0 at this time).
  2. This case works well
protoc \
  --proto_path=integration/avoid-import-conflicts \
  --plugin=./protoc-gen-ts_proto \
  --ts_proto_out=integration/avoid-import-conflicts \
  integration/avoid-import-conflicts/simple.proto integration/avoid-import-conflicts/simple2.proto
// Generated integration/avoid-import-conflicts/simple.ts looks like

import { Simple as Simple1 } from './simple2'; // Simple from simple2 is renamed
export interface Simple {
  name: string;
  otherSimple: Simple1 | undefined; // no conflicts
}
  1. Add --ts_proto_opt=outputJsonMethods=false,outputEncodeMethods=false to reproduce bug
protoc \
  --proto_path=integration/avoid-import-conflicts \
  --plugin=./protoc-gen-ts_proto \
  --ts_proto_out=integration/avoid-import-conflicts \
  --ts_proto_opt=outputJsonMethods=false,outputEncodeMethods=false \
  integration/avoid-import-conflicts/simple.proto integration/avoid-import-conflicts/simple2.proto
// Generated integration/avoid-import-conflicts/simple.ts looks like

import { Simple } from './simple2'; // Simple from simple2 is NOT renamed
export interface Simple {
  name: string;
  otherSimple: Simple | undefined; // This is conflict!
}
doochik added a commit to doochik/ts-proto that referenced this issue May 18, 2021
doochik added a commit to doochik/ts-proto that referenced this issue May 18, 2021
stephenh pushed a commit that referenced this issue May 18, 2021
## [1.80.1](v1.80.0...v1.80.1) (2021-05-18)

### Bug Fixes

* resolve import collisions for interfaces ([#300](#300)) ([773d866](773d866)), closes [#298](#298)
@stephenh
Copy link
Owner

🎉 This issue has been resolved in version 1.80.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants