You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
exporttypeUser=Message<"example.User">&{/** * @generated from field: string id = 1; */id: string;}
However, the User type is hard to use when working with the message body as data throughout the code based because of the $typeName and $unknown fileds that Message<"example.User"> adds. What if instead it generated something like:
exporttypeUserRaw={/** * @generated from field: string id = 1; */id: string;};exporttypeUser=Message<"example.User">&UserRaw
So that UserRaw can be used to hold data in the program logic, but one can also easily do:
We didn't anticipate the dislike for $typeName. We hear you, but it isn't going to be easy to fully support the removal, and there are downsides too. Because of this, we won't be generating a "raw" type in the near future.
There is an alternative, though:
The source code of protoc-gen-es is pretty compact, considering that it generates enums, types, descriptors, and JSON types. If you pick just the code to generate message types, it should be less than 500 lines of code. So my suggestion would be to create such a plugin, and give it a try. If it works out well, you could publish it for others to use.
will produce something like
However, the
User
type is hard to use when working with the message body as data throughout the code based because of the $typeName and $unknown fileds thatMessage<"example.User">
adds. What if instead it generated something like:So that
UserRaw
can be used to hold data in the program logic, but one can also easily do:This would remove the need for using a helper like
OmitTypeName
all over the place.The text was updated successfully, but these errors were encountered: