mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
@@ -35008,12 +35008,12 @@ namespace ts {
|
||||
typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
|
||||
}
|
||||
|
||||
if (type.flags & TypeFlags.Union && allTypesAssignableToKind(type, TypeFlags.StringLiteral, /*strict*/ true)) {
|
||||
if (type.flags & TypeFlags.Union && allTypesAssignableToKind(type, TypeFlags.StringOrNumberLiteral, /*strict*/ true)) {
|
||||
return grammarErrorOnNode(parameter.name,
|
||||
Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
|
||||
}
|
||||
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_string_or_number);
|
||||
return grammarErrorOnNode(parameter.name, Diagnostics.An_index_signature_parameter_type_must_be_either_string_or_number);
|
||||
}
|
||||
if (!node.type) {
|
||||
return grammarErrorOnNode(node, Diagnostics.An_index_signature_must_have_a_type_annotation);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"category": "Error",
|
||||
"code": 1022
|
||||
},
|
||||
"An index signature parameter type must be 'string' or 'number'.": {
|
||||
"An index signature parameter type must be either 'string' or 'number'.": {
|
||||
"category": "Error",
|
||||
"code": 1023
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user