-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Description
I've been trawling the repository and wiki for information regarding how to import commonjs modules (specifically, those generated by protoc
's javascript code generator) into a typescript file.
In particular, these generated files have JsDoc comments such as:
/**
* Serializes the message to binary data (in protobuf wire format).
* @return {!Uint8Array}
*/
proto.cockroach.server.serverpb.ClusterFreezeResponse.prototype.serializeBinary = function() {
...
}
As you might imagine, typescript definitions are not generated. Here's where things get confusing: the wiki page https://github.com/Microsoft/TypeScript/wiki/JsDoc-support-in-JavaScript claims that typescript supports gathering type information from some forms of JsDoc comments, but it seems to be impossible to import these commonjs modules without first writing some definitions for them (which ISTM would trample the JsDoc type information).
Does anyone have an example (or even instructions) on how this is meant to work? @RyanCavanaugh you seem to have worked on some of this - do you have an insights?