Map seems does not works properly
alexisvisco opened this issue · 2 comments
Hi,
When adding a map with a type it seems like the generated code not compile.
Example repository : https://github.com/alexisvisco/protocol-example/tree/maps-does-not-works
With this property https://github.com/alexisvisco/protocol-example/blob/maps-does-not-works/protos/leads/v1/leads.proto#L70
Argument type (msg: MapMessage<CreateRequest.LenderPlans>) => Record<string, unknown> is not assignable to parameter type (value: {value: any, key: string}, index: number, array: {value: any, key: string}[]) => Record<string, unknown>
Argument type (number | LenderLoanPlan | undefined)[][] is not assignable to parameter type Iterable<readonly [PropertyKey, (number | undefined)]>
Argument type (msg: MapMessage<ComputeDatedLoanPlansResponse.LenderPlans>, json: any) => MapMessage<ComputeDatedLoanPlansResponse.LenderPlans> is not assignable to parameter type (value: {value: any, key: string}, index: number, array: {value: any, key: string}[]) => MapMessage<ComputeDatedLoanPlansResponse.LenderPlans>
@alexisvisco could you confirm which version of TwirpScript and TypeScript you're using?
I see "twirpscript": "^0.0.47"
in your example and no yarn.lock
. Do you still run into this issue on v0.0.50
?
When I clone this repo, update twirpscript to v0.0.50 and run buf generate
followed by tsc --noEmit
the only errors I see are:
gen/ts/protos/leads/v1/leads.pb.ts:1106:15 - error TS2737: BigInt literals are not available when targeting lower than ES2020.
Updating compilerOptions.target
to es2020
resolves these.
Update
Sorry I was on the main
branch. You can ignore the above. Switching to your branch I can recreate this issue.