Cleanup assignments (#2811)

* Cleanup assignments

* Small adjustments

* Cleanup AnyJson results

* Event toHuman
This commit is contained in:
Jaco Greeff
2020-10-31 12:50:44 +01:00
committed by GitHub
parent 5be8ef8f0d
commit 94a4594d32
16 changed files with 70 additions and 108 deletions
@@ -51,9 +51,7 @@ function retrieveProposals (api: ApiInterfaceRx, proposalCount: ProposalIndex, a
const count = proposalCount.toNumber();
for (let index = 0; index < count; index++) {
const isApproval = approvalIds.some((id): boolean => id.eqn(index));
if (!isApproval) {
if (!approvalIds.some((id) => id.eqn(index))) {
proposalIds.push(api.registry.createType('ProposalIndex', index));
}
}
@@ -36,9 +36,9 @@ export default class HeaderExtended extends _Header {
/**
* @description Creates a human-friendly JSON representation
*/
public toHuman (isExtended?: boolean): AnyJson {
public toHuman (isExtended?: boolean): Record<string, AnyJson> {
return {
...super.toHuman(isExtended) as { [index: string]: AnyJson },
...super.toHuman(isExtended),
author: this.author
? this.author.toHuman()
: undefined
@@ -48,9 +48,9 @@ export default class HeaderExtended extends _Header {
/**
* @description Creates the JSON representation
*/
public toJSON (): AnyJson {
public toJSON (): Record<string, AnyJson> {
return {
...super.toJSON() as { [index: string]: AnyJson },
...super.toJSON(),
author: this.author
? this.author.toJSON()
: undefined
@@ -36,9 +36,9 @@ export default class BlockExtended extends _SignedBlock {
/**
* @description Creates a human-friendly JSON representation
*/
public toHuman (isExtended?: boolean): AnyJson {
public toHuman (isExtended?: boolean): Record<string, AnyJson> {
return {
...super.toHuman(isExtended) as { [index: string]: AnyJson },
...super.toHuman(isExtended),
author: this.author
? this.author.toHuman()
: undefined
@@ -48,9 +48,9 @@ export default class BlockExtended extends _SignedBlock {
/**
* @description Creates the JSON representation
*/
public toJSON (): AnyJson {
public toJSON (): Record<string, AnyJson> {
return {
...super.toJSON() as { [index: string]: AnyJson },
...super.toJSON(),
author: this.author
? this.author.toJSON()
: undefined