-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
--allowJs and generated protocol buffers #9509
Comments
the system can not reason about such helper functions, e.g.
open the file in VSCode, and hover over identifiers. it should show you what the TS type system thinks of them. |
Bummer. How do you feel about adding hooks for "teaching" TS about this class of helper e.g. via a definition file? (perhaps it's already possible to do this?)
Is that the only way? Is there no way to do it outside of VSCode? |
sure. what kind of hooks? would be open to proposals.
you can use the compiler API and do it other forms. VSCode/Sublime/VS are just easier. |
Within Google we use https://github.com/angular/clutz to generate TypeScript d.ts files from the Closure JS generated by the protocol compiler. Clutz hooks into the Closure compiler API so it understands the generated code well. CC @rkirov |
@evmar just to clarify, the process is:
Steps 3 and 4 are what's unclear to me. In particular, we are using SystemJS and plugin-typescript to do all our compilation in the browser. In other words, we really want to avoid having to run Closure on the output of the typescript compiler (because that's not really tractable). Is that possible? |
@evmar FWIW, +1 to this workflow problem. I'm fighting my way through this as well in developing an ES2015 library that handles google protobufs. I've spent over a week trying to force protobufjs with @types/protobufjs only to have that route fall completely apart from endless packaging issues for how to deploy that library to the browser (tried jspm, webpack, systemjs). I switched to google-protobuf only to find #1, I can't use Is there a full, working example of this configuration anywhere in the wild that someone can reference? |
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed. |
Currently, Google's protocol buffer compiler at https://github.com/google/protobuf/tree/master/js generates code that looks something like:
See also actual generated code.
I'm not really sure what the underlying cause is, but I can't seem to get any use out of the (presumed) types inferred from the JsDoc comments in this file.
By the way, is it possible to examine the result of
--allowJs
to see what the typescript compiler was able to infer?The text was updated successfully, but these errors were encountered: