Closed jereklas closed 1 year ago
I seem to be getting hit by this issue also.
Is there any workaround for it?
src/company/protobuf/policies/v2/policy.ts:2922:20 - error TS2352: Conversion of type 'import("develop/company/protobuf/grpc_tools_node_protoc_ts/dist/src/company/protobuf/policies/v2/policy").company.protobuf.policies.v2.MotorClassOfUse' to type 'MotorClassOfUse[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
2922 return pb_1.Message.getFieldWithDefault(this, 1, MotorClassOfUse.MOTOR_CLASS_OF_USE_UNSPECIFIED) as MotorClassOfUse[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/company/protobuf/policies/v2/policy.ts:2928:20 - error TS2352: Conversion of type 'import("develop/company/protobuf/grpc_tools_node_protoc_ts/dist/src/company/protobuf/policies/v2/policy").company.protobuf.policies.v2.MotorPeril' to type 'MotorPeril[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
2928 return pb_1.Message.getFieldWithDefault(this, 2, MotorPeril.MOTOR_PERIL_UNSPECIFIED) as MotorPeril[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/company/protobuf/policies/v2/policy.ts:3052:20 - error TS2352: Conversion of type 'import("develop/company/protobuf/grpc_tools_node_protoc_ts/dist/src/company/protobuf/policies/v2/policy").company.protobuf.policies.v2.MotorClassOfUse' to type 'MotorClassOfUse[]' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.
3052 return pb_1.Message.getFieldWithDefault(this, 1, MotorClassOfUse.MOTOR_CLASS_OF_USE_UNSPECIFIED) as MotorClassOfUse[];
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Is there any workaround for it?
Not yet. Though this is trivial to fix. I just didn't have the time to work on it myself.
If you can point me to the general area I can take a look. Not really a TS developer. Trying to create a POC using our protobuf library in a nextjs project. The protobuf library is quite large. We have scala, .net and python libraries generated. I was trying to add TS.
In other news. I changed the code above and everything worked when calling our gRPC service. :-)
My solution was to change the proto definition to not use an enum. When this gets fixed we’ll reconsider the enum solution
@thesayyn Thank you so much for merging so quickly! It'd be great if you could push a new release to NPM... I'm now aware of an easy way to use the latest HEAD.
Thanks in advance.
@thesayyn Thank you so much for merging so quickly! It'd be great if you could push a new release to NPM... I'm now aware of an easy way to use the latest HEAD.
Thanks in advance.
Repeated enums result in typescript errors on the generated files. The following proto file:
Results in the following generated TS:
Which contains the following error:
The underlying implementation of it appears to be working fine? it's just typed incorrectly.