Let's imagine I have 2 Nest.js services: Service A and Service B, which communicate using gRPC. I am trying to pass an object of type UserSettings from Service A to Service B via Remote Procedure Call (RPC)
Let's imagine in service A we have types:
enum Language {
AMERICAN_ENGLISH = "en/us",
BRITISH_ENGLISH = "en/uk",
ITALIAN = "it"
}
type UserSettings = {
theme: "dark" | "white";
language: Language;
device: string | number;
}
How to correctly map UserSettings with this rich Typescript type to .proto file?
I have reached the point where I understand I can not use as many features in protobufs as I can in Typescript.
So, should I use some mapper functions, to map UserSettings to UserSettingsProto before calling rpc in Service A, and then in Service B, to map from UserSettingsProto to UserSettings, or is there a better approach?