BlockParam unrolls into number | BlockParamLiteral, though BlockParamLiteral does not get imported. This results in type build errors in downstream projects where tslint checks libs
before this change, TypeScript compilation of the generated contract
wrapper was giving me the following errors:
$ abi-gen --abis 'build/contracts/*.json' --out build/types --template contract_templates/contract.handlebars --partials 'contract_templates/partials/*.handlebars'
Found 7 partial templates
Found 1 ABI files
Processing: Migrations...
Created: build/types/migrations.ts
$ tsc
build/types/migrations.ts(81,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(108,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(130,23): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(146,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(173,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
build/types/migrations.ts(195,25): error TS1013: A rest parameter or binding pattern may not have a trailing comma.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Here is the generated code around the first error:
74: public setCompleted = {
75: async sendTransactionAsync(
76: completed: BigNumber,
77: txData: Partial<TxData> = {},
78: ): Promise<string> {
79: const self = this as any as MigrationsContract;
80: const inputAbi = self._lookupAbi('setCompleted(uint256)').inputs;
81: [completed,
82: ] = BaseContract._formatABIDataItemList(inputAbi, [completed,
83: ], BaseContract._bigNumberToString.bind(self));
All of the other errors are the same, a destructuring assignment with a
single element but with a trailing comma.
This is legal JavaScript but it is not allowed by the TypeScript
compiler, apparently per the bug described at
https://github.com/Microsoft/TypeScript/issues/24628 .
While awaiting the 3.0 version of TypeScript, it's a simple enough
change to have the template not append a trailing comma.