add additional typings to collection
parent
633f380cb8
commit
ef3919ce92
|
@ -110,7 +110,7 @@ export default class Collection<V> extends Map<string, V> {
|
||||||
*/
|
*/
|
||||||
reduce(func: Function, initialValue = 0) {
|
reduce(func: Function, initialValue = 0) {
|
||||||
const iter = this.values();
|
const iter = this.values();
|
||||||
let val;
|
let val: any;
|
||||||
let result = initialValue === undefined ? iter.next().value : initialValue;
|
let result = initialValue === undefined ? iter.next().value : initialValue;
|
||||||
while ((val = iter.next().value) !== undefined) { // eslint-disable-line
|
while ((val = iter.next().value) !== undefined) { // eslint-disable-line
|
||||||
result = func(result, val);
|
result = func(result, val);
|
||||||
|
@ -159,7 +159,7 @@ export default class Collection<V> extends Map<string, V> {
|
||||||
* @param key The key of the object
|
* @param key The key of the object
|
||||||
* @returns The removed object, or `null` if nothing was removed
|
* @returns The removed object, or `null` if nothing was removed
|
||||||
*/
|
*/
|
||||||
remove(key): V {
|
remove(key: string): V {
|
||||||
const item = this.get(key);
|
const item = this.get(key);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue