mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Use same error for iteration in <=ES5 (#48881)
* Use the same error for iterating over an Iterable in ES5 or lower. * Accepted baselines.
This commit is contained in:
committed by
GitHub
parent
189c2b9e4a
commit
18b08fc7c9
@@ -38250,7 +38250,7 @@ namespace ts {
|
||||
|
||||
return (use & IterationUse.PossiblyOutOfBounds) ? includeUndefinedInIndexSignature(arrayElementType) : arrayElementType;
|
||||
|
||||
function getIterationDiagnosticDetails(allowsStrings: boolean, downlevelIteration: boolean | undefined): [DiagnosticMessage, boolean] {
|
||||
function getIterationDiagnosticDetails(allowsStrings: boolean, downlevelIteration: boolean | undefined): [error: DiagnosticMessage, maybeMissingAwait: boolean] {
|
||||
if (downlevelIteration) {
|
||||
return allowsStrings
|
||||
? [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator, true]
|
||||
@@ -38260,7 +38260,7 @@ namespace ts {
|
||||
const yieldType = getIterationTypeOfIterable(use, IterationTypeKind.Yield, inputType, /*errorNode*/ undefined);
|
||||
|
||||
if (yieldType) {
|
||||
return [Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators, false];
|
||||
return [Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher, false];
|
||||
}
|
||||
|
||||
if (isES2015OrLaterIterable(inputType.symbol?.escapedName)) {
|
||||
|
||||
@@ -2511,10 +2511,7 @@
|
||||
"category": "Error",
|
||||
"code": 2568
|
||||
},
|
||||
"Type '{0}' is not an array type or a string type. Use compiler option '--downlevelIteration' to allow iterating of iterators.": {
|
||||
"category": "Error",
|
||||
"code": 2569
|
||||
},
|
||||
|
||||
"Could not find name '{0}'. Did you mean '{1}'?": {
|
||||
"category": "Error",
|
||||
"code": 2570
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace ts.codefix {
|
||||
Diagnostics.This_condition_will_always_return_true_since_this_0_is_always_defined.code,
|
||||
Diagnostics.Type_0_is_not_an_array_type.code,
|
||||
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type.code,
|
||||
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_Use_compiler_option_downlevelIteration_to_allow_iterating_of_iterators.code,
|
||||
Diagnostics.Type_0_can_only_be_iterated_through_when_using_the_downlevelIteration_flag_or_with_a_target_of_es2015_or_higher.code,
|
||||
Diagnostics.Type_0_is_not_an_array_type_or_a_string_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
||||
Diagnostics.Type_0_is_not_an_array_type_or_does_not_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
||||
Diagnostics.Type_0_must_have_a_Symbol_iterator_method_that_returns_an_iterator.code,
|
||||
|
||||
Reference in New Issue
Block a user