toJSON returns the correct type (#1038)

* Introduce AnyJson

* Other small fixes
This commit is contained in:
Amaury Martiny
2019-06-19 21:11:32 +02:00
committed by Jaco Greeff
parent fb357dc455
commit 7b461e7f21
24 changed files with 45 additions and 37 deletions
@@ -3,6 +3,7 @@
// of the Apache-2.0 license. See the LICENSE file for details.
import { AccountId, Header, u64 } from '@polkadot/types';
import { AnyJsonObject } from '@polkadot/types/types';
/**
* @name HeaderExtended
@@ -65,9 +66,9 @@ export default class HeaderExtended extends Header {
/**
* @description Creates the JSON representation
*/
toJSON (): any {
toJSON (): AnyJsonObject {
return {
...super.toJSON(),
...super.toJSON() as AnyJsonObject,
author: this.author
? this.author.toJSON()
: undefined
@@ -4,6 +4,7 @@
import BN from 'bn.js';
import { ReferendumInfo, ReferendumIndex } from '@polkadot/types';
import { AnyJsonObject } from '@polkadot/types/types';
/**
* @name ReferendumInfoExtended
@@ -31,9 +32,9 @@ export default class ReferendumInfoExtended extends ReferendumInfo {
/**
* @description Creates the JSON representation
*/
toJSON (): any {
toJSON (): AnyJsonObject {
return {
...super.toJSON(),
...super.toJSON() as AnyJsonObject,
index: this.index.toJSON()
};
}