-
Notifications
You must be signed in to change notification settings - Fork 72
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
Is it possible to use 'import_style' for Typescript #69
Comments
I'm afraid we don't have much experience with TypeScript and so I'm not sure of the best way to handle that use case well. If you have any ideas then we would probably be open to taking pull requests, though. |
@wiewioraseb we currently use this plugin to generate the typescript typings, maybe it helps you? |
@dominikeinkemmer would it make sense to name the issue "TypeScript Support"? @acozzette note that grpc-web already implemented Typescript support - see here https://github.com/grpc/grpc-web#typescript-support @dominikeinkemmer In order to get the definitions working it's possible to just create a dummy gRPC service that depends on some protobuf hierarchy and using
will work. As an additional note, it would also be nice to support a fluent API and have some thinking around JS / TS number type vs the variety that protobuf supports. Referencehttps://github.com/dcodeIO/ProtoBuf.js/#usage-with-typescript |
This is related / duplicates #98 |
Is workaround with gRPC service still necessary just to import generated files with type definitions to typescript ? |
For this particular problem, we have created a plugin that generates typescript sources. You do not need to depend on js generator or ts-protoc-gen. It is just pure typescript sources that work out-of-the-box. This might solve your problem. |
I've made a PR for "native" Typescript support over at protocolbuffers/protobuf#9412. Any help is more than welcome, I am way out of my depth in c++ |
Duplicate of #98 |
I want to have access to types when I get statically generated protobuff files.
Running code:
protoc -I=Protos --js_out=import_style=es6,binary:Javascript Protos/MessageEvnelope.proto Protos/Messages.proto
Generates .js files that are not easily imported in Typescript. When:
import { SomeMessage } from './Messages_pb';
I got error:
To overcome this, I have to use
require('./Messages_pb')
which results with no types, which does not satisfy me.Is there an automatic way to create types for such generated js file? Or some other way to have types in typescript?
The text was updated successfully, but these errors were encountered: