TypeScript conversion (#142)

* Auto-conversion

* Cleanup type conversion errors

* Inching closer, resolution sorted

* Additional cleanups

* TS, TS everywhere

* Minor version for TS release

* Last roundups
This commit is contained in:
Jaco Greeff
2018-06-22 21:17:50 +02:00
committed by GitHub
parent ad444e27d7
commit 4470dfa7b9
190 changed files with 1085 additions and 2061 deletions
@@ -1,7 +1,6 @@
// Copyright 2017-2018 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
import stringShorten from './shorten';
@@ -1,11 +1,10 @@
// Copyright 2017-2018 @polkadot/util authors & contributors
// This software may be modified and distributed under the terms
// of the ISC license. See the LICENSE file for details.
// @flow
/**
@name stringShorten
@signature stringShorten (value: mixed, prefixLength: number = 8): string
@signature stringShorten (value: any, prefixLength: number = 8): string
@summary Returns a string with maximum length
@description
Checks the string against the `prefixLength`, if longer than dopuble this, shortens it by placing `..` in the middle of it
@@ -14,8 +13,7 @@
stringShorten('1234567890', 2); // => 12..90
*/
export default function stringShorten (_value: mixed, prefixLength: number = 6): string {
// $FlowFixMe coerced into string (by any means)
export default function stringShorten (_value: any, prefixLength: number = 6): string {
const value = `${_value}`;
if (value.length <= 2 + 2 * prefixLength) {