mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-14 19:16:17 -06:00
Keep linter happy with fix in reduceLeft/reduceRight
This commit is contained in:
parent
097f4564bb
commit
689e28d3ac
@ -242,9 +242,17 @@ namespace ts {
|
||||
const count = array.length;
|
||||
if (count > 0) {
|
||||
let pos = 0;
|
||||
let result = arguments.length <= 2 ? array[pos++] : initial;
|
||||
let result: T | U;
|
||||
if (arguments.length <= 2) {
|
||||
result = array[pos];
|
||||
pos++;
|
||||
}
|
||||
else {
|
||||
result = initial;
|
||||
}
|
||||
while (pos < count) {
|
||||
result = f(<U>result, array[pos++]);
|
||||
result = f(<U>result, array[pos]);
|
||||
pos++;
|
||||
}
|
||||
return <U>result;
|
||||
}
|
||||
@ -258,9 +266,17 @@ namespace ts {
|
||||
if (array) {
|
||||
let pos = array.length - 1;
|
||||
if (pos >= 0) {
|
||||
let result = arguments.length <= 2 ? array[pos--] : initial;
|
||||
let result: T | U;
|
||||
if (arguments.length <= 2) {
|
||||
result = array[pos];
|
||||
pos--;
|
||||
}
|
||||
else {
|
||||
result = initial;
|
||||
}
|
||||
while (pos >= 0) {
|
||||
result = f(<U>result, array[pos--]);
|
||||
result = f(<U>result, array[pos]);
|
||||
pos--;
|
||||
}
|
||||
return <U>result;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user