CreateType is typed, add createTypeUnsafe just in case (#1199)

* Use unsafe internally

* Add comments

* Remove <> in createType

* Fix lint

* Fix classOf

* Remove createType from Text

* Fix lint

* Fix Fallback type

* Fix fallback in createType
This commit is contained in:
Amaury Martiny
2019-07-26 14:00:25 +02:00
committed by Jaco Greeff
parent ec0b9a84a3
commit 441148889d
24 changed files with 112 additions and 104 deletions
@@ -2,8 +2,6 @@
// This software may be modified and distributed under the terms
// of the Apache-2.0 license. See the LICENSE file for details.
import { Balance } from '@polkadot/types/interfaces';
import BN from 'bn.js';
import { combineLatest, Observable, of } from 'rxjs';
import { map, switchMap } from 'rxjs/operators';
@@ -28,7 +26,7 @@ export function referendumVotesFor (api: ApiInterfaceRx): (referendumId: BN | nu
map(([votersFor, votes, balances]): DerivedReferendumVote[] =>
votersFor.map((accountId, index): DerivedReferendumVote => ({
accountId,
balance: balances[index].votingBalance || createType<Balance>('Balance', 0),
balance: balances[index].votingBalance || createType('Balance', 0),
vote: votes[index] || new Vote(0)
} as unknown as DerivedReferendumVote))
),