Open
Description
protobuf.js version: 6.8.8
When generating Typescript definitions for .proto files, the JSDoc comment is copied correctly to the resulting class in the type defs, but the interface for that class just has a comment reading: "Properties of a [classname]". This isn't a useful comment and it makes more sense for the consumer of the types to make the interface doc a duplicate of the class doc.
syntax = "proto3";
package example;
import "google/protobuf/empty.proto";
/**
* Service to demonstrate the example
*
* Some further description
*/
service ExampleService {
/**
* Get a message telling you hello
*/
rpc sayHello (Empty) returns (HelloMessage) {}
}
/**
* Message response from the sayHello endpoint
*
* Contains a friendly message
*/
message HelloMessage {
/**
* A friendly message
*/
string message = 1;
}
pbjs -t static-module -w commonjs --es6 -o lib/index.js proto/*.proto
pbts -o lib/index.d.ts lib/index.js
/// ...
/** Properties of a HelloMessage. */
interface IHelloMessage {
/** A friendly message */
message?: (string|null);
}
/**
* Message response from the sayHello endpoint
*
* Contains a friendly message
*/
class HelloMessage implements IHelloMessage { /* ... */ }
As you can see, the comments for the properties of the interface are copied but the comment for the interface itself is just "Properties of a ClassName", where it would be more useful to have copied the comment from the class.