(hopefully) fix d.ts generation with explicit imports (#394)

This commit is contained in:
Jaco Greeff
2018-11-13 11:28:06 +01:00
committed by GitHub
parent d3d4f992ed
commit de284fb2f9
3 changed files with 17 additions and 7 deletions
+5 -3
View File
@@ -2,8 +2,10 @@
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
import { RpcRxInterface, RpcRxInterface$Method, RpcRxInterface$Section } from '@polkadot/rpc-rx/types';
import { Extrinsics } from '@polkadot/extrinsics/types';
import { RpcMethod } from '@polkadot/jsonrpc/types';
import { RpcRxInterface, RpcRxInterface$Method, RpcRxInterface$Section } from '@polkadot/rpc-rx/types';
import { Storage } from '@polkadot/storage/types';
import { EMPTY, Observable, combineLatest, from } from 'rxjs';
import { defaultIfEmpty, map } from 'rxjs/operators';
@@ -37,8 +39,8 @@ export default class ApiBase {
this.whenReady = from(this.init());
}
static extrinsics = extrinsicsStatic;
static storage = storageStatic;
static extrinsics: Extrinsics = extrinsicsStatic;
static storage: Storage = storageStatic;
// FIXME This logic is duplicated in api-rx, since that should derive
// from that base, it should be removed when the actual extend is done
+10 -3
View File
@@ -4,9 +4,12 @@
import BN from 'bn.js';
import { AccountId, Balance, BlockNumber, PropIndex, Proposal, ReferendumIndex, VoteThreshold } from '@polkadot/types/index';
import { Constructor } from '@polkadot/types/types';
import { Struct, Tuple, Vector } from '@polkadot/types/codec';
export class RxProposal extends Struct.with({ id: PropIndex, proposal: Proposal, address: AccountId }) {
const ProposalStruct: Constructor<Struct<any>> = Struct.with({ id: PropIndex, proposal: Proposal, address: AccountId });
export class RxProposal extends ProposalStruct {
constructor (value: Tuple) {
super({
id: value.getAtIndex(0),
@@ -28,7 +31,9 @@ export class RxProposal extends Struct.with({ id: PropIndex, proposal: Proposal,
}
}
export class RxProposalDeposits extends Struct.with({ balance: Balance, addresses: Vector.with(AccountId) }) {
const DepositStruct: Constructor<Struct<any>> = Struct.with({ balance: Balance, addresses: Vector.with(AccountId) });
export class RxProposalDeposits extends DepositStruct {
constructor (value: Tuple) {
super({
balance: value.getAtIndex(0),
@@ -45,7 +50,9 @@ export class RxProposalDeposits extends Struct.with({ balance: Balance, addresse
}
}
export class RxReferendum extends Struct.with({ blockNumber: BlockNumber, proposal: Proposal, voteThreshold: VoteThreshold, id: ReferendumIndex }) {
const ReferendumStruct: Constructor<Struct<any>> = Struct.with({ blockNumber: BlockNumber, proposal: Proposal, voteThreshold: VoteThreshold, id: ReferendumIndex });
export class RxReferendum extends ReferendumStruct {
constructor (value: Tuple, id: ReferendumIndex | BN | number) {
super({
blockNumber: value.getAtIndex(0),