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,14 +1,13 @@
// 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 isNull from '../is/null';
import isUndefined from '../is/undefined';
/**
@name arrayFilter
@signature arrayFilter (array: Array<mixed>, allowNulls: boolean = true): Array<mixed>
@signature arrayFilter (array: Array<any>, allowNulls: boolean = true): Array<any>
@summary Filters undefined and (optionally) null values from an array
@description
Returns a new array with all `undefined` values removed. Optionally, when `allowNulls = false`, it removes the `null` values as well
@@ -18,7 +17,7 @@ import isUndefined from '../is/undefined';
arrayFilter([0, void 0, true, null, false, '']); // [0, true, null, false, '']
arrayFilter([0, void 0, true, null, false, ''], false); // [0, true, false, '']
*/
export default function arrayFilter (array: Array<mixed>, allowNulls: boolean = true): Array<mixed> {
export default function arrayFilter (array: Array<any>, allowNulls: boolean = true): Array<any> {
return array.filter((value) => {
return !isUndefined(value) && (allowNulls || !isNull(value));
});
@@ -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 arrayFilter from './filter';