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

Match name nesting and imports in .d.ts with .js files #433

Merged
merged 3 commits into from
Jan 15, 2019

Conversation

shaxbee
Copy link
Contributor

@shaxbee shaxbee commented Jan 10, 2019

Exported names were incorrectly mangled and didn't reflect types in * pb.js files, resulting in runtime errors where trying to instantiate.
Type aliases were replaced with proper nesting based on improbable-eng/ts-protoc-gen.
Aliased imports reflecting *pb.js files were added.
Services now return correct message types for external protos.

@stanley-cheung
Copy link
Collaborator

@shaxbee Thanks for this contributions. Can you give us an example on what this achieves? Like maybe a couple of simple .protos and what the current and new behavior would be? Thanks

@shaxbee
Copy link
Contributor Author

shaxbee commented Jan 11, 2019

@stanley-cheung Example generated code can be seen in shaxbee/grpc-web-dts-example

Code generated using master branch:

  • Exported subclass names and messages from other packages are not present in master/example_pb.js.
  • Nested type aliases result in compilation errors.

Code generated using typings-nesting-and-imports branch:

  • Working imports from external protos
  • Correct nesting
  • Names matching generated js code

My intent with this and future typings pull requests is to provide feature parity with ts-protoc-gen and eventually prepare pull request to protobuf, so typings for messages are generated in protoc-gen-js plugin :-)

Copy link
Collaborator

@stanley-cheung stanley-cheung left a comment

Choose a reason for hiding this comment

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

Thanks for the contributions!

@stanley-cheung stanley-cheung merged commit 01ed706 into grpc:master Jan 15, 2019
@shaxbee shaxbee deleted the typings-nesting-and-imports branch January 15, 2019 22:36
@shinofara
Copy link

@stanley-cheung
I am waiting for the release.

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

Successfully merging this pull request may close these issues.

None yet

4 participants