function getSelectedOneofValue(oneof) {
    if (oneof.oneofKind === undefined) {
        return undefined;
    }
    return oneof[oneof.oneofKind];
}
Returns the selected value of the given oneof group.

Not that the recommended way to access a oneof group is to check
the "oneofKind" property and let TypeScript narrow down the union
type for you:

```ts
if (message.result.oneofKind === "error") {
  message.result.error; // string
}
```

In the rare case you just need the value, and do not care about
which protobuf field is selected, you can use this function
for convenience.