mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
allow const enum in type query (#21083)
This commit is contained in:
committed by
Mohamed Hegazy
parent
ef5a289966
commit
062f97a6fa
@@ -19474,10 +19474,11 @@ namespace ts {
|
||||
const ok =
|
||||
(node.parent.kind === SyntaxKind.PropertyAccessExpression && (<PropertyAccessExpression>node.parent).expression === node) ||
|
||||
(node.parent.kind === SyntaxKind.ElementAccessExpression && (<ElementAccessExpression>node.parent).expression === node) ||
|
||||
((node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) && isInRightSideOfImportOrExportAssignment(<Identifier>node));
|
||||
((node.kind === SyntaxKind.Identifier || node.kind === SyntaxKind.QualifiedName) && isInRightSideOfImportOrExportAssignment(<Identifier>node) ||
|
||||
(node.parent.kind === SyntaxKind.TypeQuery && (<TypeQueryNode>node.parent).exprName === node));
|
||||
|
||||
if (!ok) {
|
||||
error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment);
|
||||
error(node, Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
|
||||
}
|
||||
}
|
||||
return type;
|
||||
|
||||
@@ -1620,7 +1620,7 @@
|
||||
"category": "Error",
|
||||
"code": 2474
|
||||
},
|
||||
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment.": {
|
||||
"'const' enums can only be used in property or index access expressions or the right hand side of an import declaration or export assignment or type query.": {
|
||||
"category": "Error",
|
||||
"code": 2475
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user