News for hackers. Stuff that matters.
Re:Full-Stack TypeScript with tRPC and React by tczMUFlmoNk on Tuesday March 14, 2023 @06:19PM (#35159854)
> Also, using a `oneof` field is correctly typed on the frontend as

    myfield: TypeA | TypeB | TypeC
But what about when the `oneof` has multiple variants with the same base type? Like:

    message User {
        oneof contact_info {
            string email = 1;
            string phone_number = 2;
        }
    }
Does this get compiled down to `contact_info: string | string` on the frontend? How do you tell which variant was used without encoding the discriminant?

There are no comments on this comment yet.