You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Protobuf prefixes pb_ to fields with the name of a reserved Javascript keyword when calling the toObject() method, but the generated TypeScript typings Message.AsObject don't seem to take this into account. It's documented in this comment and the list of keywords used is here.
With the following proto file from the examples I've added a function field.
I can see that the AsObject type is defined in src/lib/template/partial/message.hbs lines 61 to 81 and I guess it should be trivial to verify each field name against the list of reserved keywords and prefix as necessary before handing the data to the template.
I'll be happy to provide a PR with a fix, but do you handle any other special cases at the moment, so I can make it in the same manner?
The text was updated successfully, but these errors were encountered:
Protobuf prefixes
pb_
to fields with the name of a reserved Javascript keyword when calling thetoObject()
method, but the generated TypeScript typingsMessage.AsObject
don't seem to take this into account. It's documented in this comment and the list of keywords used is here.With the following
proto
file from the examples I've added afunction
field.The generated Javascript for
toObject()
becomes the following. Notice thepb_
prefix on thefunction
field.And this is the TypeScript for the return value of
toObject()
:I can see that the
AsObject
type is defined insrc/lib/template/partial/message.hbs
lines 61 to 81 and I guess it should be trivial to verify each field name against the list of reserved keywords and prefix as necessary before handing the data to the template.I'll be happy to provide a PR with a fix, but do you handle any other special cases at the moment, so I can make it in the same manner?
The text was updated successfully, but these errors were encountered: