Open
Description
syntax = "proto3";
package example;
message User {
string id = 1;
}
will produce something like
export type User = 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:
export type UserRaw = {
/**
* @generated from field: string id = 1;
*/
id: string;
};
export type User = Message<"example.User"> & UserRaw
So that UserRaw
can be used to hold data in the program logic, but one can also easily do:
const user: UserRaw = { id: "123" };
create(UserSchema, user)
This would remove the need for using a helper like OmitTypeName
all over the place.
Metadata
Assignees
Labels
No labels
Activity