protoc-gen-ts | Compile protocol buffer messages to TypeScript
kandi X-RAY | protoc-gen-ts Summary
kandi X-RAY | protoc-gen-ts Summary
Compile protocol buffer messages to TypeScript.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of protoc-gen-ts
protoc-gen-ts Key Features
protoc-gen-ts Examples and Code Snippets
Community Discussions
Trending Discussions on protoc-gen-ts
QUESTION
i need to use GRPC in nodejs an type script project , i have a problem with generate proto files in windows 10 and npm .
i want to ru this file transpile-proto-ts.sh
:
ANSWER
Answered 2022-Mar-22 at 06:47Make sure that your sh file is executable as
QUESTION
Here is the structure for src
directory of my project:
ANSWER
Answered 2020-Aug-25 at 04:00Your dynamic codegen is failing because you are not specifying the paths to search for imported .proto
files. You can do this using the includeDirs
option when calling protoLoader.loadSync
, which works in a very similar way to the -I
option you pass to protoc
. In this case, you are loading the proto files from the src/protos
directory, so it should be sufficient to pass the option includeDirs: [__dirname]
. Then the import paths in your .proto
files should be relative to that directory, just like when you use protoc
.
You are probably seeing the same error when you try to use the static code generation because it is actually the dynamic codegen error; you don't appear to be removing the dynamic codegen code when trying to use the statically generated code.
However, the main problem you will face with the statically generated code is that you are only generating the TypeScript type definition files. You also need to generate JavaScript files to actually run it. The official Node gRPC plugin for proto
is distributed in the grpc-tools
package. It comes with a binary called grpc_tools_node_protoc
, which should be used in place of protoc
and automatically includes the plugin. You will still need to pass a --js_out
flag to generate that code.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install protoc-gen-ts
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page