protobuf-ts icon indicating copy to clipboard operation
protobuf-ts copied to clipboard

Replace "kind" string literals in field information with enum

Open timostamm opened this issue 4 years ago • 0 comments

From #15:

export enum FieldKind {
  SCALAR, MAP, ENUM, MESSAGE
}

The generated field information could use the same pseudo-inlined code [as RepeatType, etc.]:

kind: 1 /*FieldKind.SCALAR*/

This would save quite some bytes in the generated code. It would add some bytes to the runtime, because string literals "scalar" would need to be replaced with FieldKind.SCALAR. But maybe there are some ways around it.

timostamm avatar Apr 10 '21 16:04 timostamm