From 87fabbb943779d868d29c437f078a341cb177b2b Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 17 Oct 2018 17:36:21 +0100 Subject: chore: Fix remaining necessary casts --- packages/sol-compiler/src/utils/encoder.ts | 5 +++-- packages/sol-doc/src/sol_doc.ts | 10 ++++++---- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'packages') diff --git a/packages/sol-compiler/src/utils/encoder.ts b/packages/sol-compiler/src/utils/encoder.ts index 0f2d75691..6527304d6 100644 --- a/packages/sol-compiler/src/utils/encoder.ts +++ b/packages/sol-compiler/src/utils/encoder.ts @@ -1,4 +1,4 @@ -import { AbiDefinition, AbiType, ContractAbi, DataItem } from 'ethereum-types'; +import { AbiDefinition, AbiType, ConstructorAbi, ContractAbi, DataItem } from 'ethereum-types'; import * as _ from 'lodash'; import * as web3Abi from 'web3-eth-abi'; @@ -7,7 +7,8 @@ export const encoder = { const constructorTypes: string[] = []; _.each(abi, (element: AbiDefinition) => { if (element.type === AbiType.Constructor) { - _.each(element.inputs, (input: DataItem) => { + const constuctorAbi = element as ConstructorAbi; + _.each(constuctorAbi.inputs, (input: DataItem) => { constructorTypes.push(input.type); }); } diff --git a/packages/sol-doc/src/sol_doc.ts b/packages/sol-doc/src/sol_doc.ts index 138882c92..35ba2c6e8 100644 --- a/packages/sol-doc/src/sol_doc.ts +++ b/packages/sol-doc/src/sol_doc.ts @@ -324,19 +324,21 @@ export class SolDoc { switch (abiDefinition.type) { case 'constructor': docSection.constructors.push( - this._genConstructorDoc(contractName, abiDefinition, compiledContract.devdoc), + this._genConstructorDoc(contractName, abiDefinition as ConstructorAbi, compiledContract.devdoc), ); break; case 'event': - (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition)); + (docSection.events as Event[]).push(SolDoc._genEventDoc(abiDefinition as EventAbi)); // note that we're not sending devdoc to this._genEventDoc(). // that's because the type of the events array doesn't have any fields for documentation! break; case 'function': - docSection.methods.push(this._genMethodDoc(abiDefinition, compiledContract.devdoc)); + docSection.methods.push(this._genMethodDoc(abiDefinition as MethodAbi, compiledContract.devdoc)); break; case 'fallback': - docSection.methods.push(SolDoc._genFallbackDoc(abiDefinition, compiledContract.devdoc)); + docSection.methods.push( + SolDoc._genFallbackDoc(abiDefinition as FallbackAbi, compiledContract.devdoc), + ); break; default: throw new Error( -- cgit v1.2.3