mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
fix(41965): fix error in definite assignment assertion context (#41989)
This commit is contained in:
@@ -40134,7 +40134,9 @@ namespace ts {
|
||||
if (node.exclamationToken && (node.parent.parent.kind !== SyntaxKind.VariableStatement || !node.type || node.initializer || node.flags & NodeFlags.Ambient)) {
|
||||
const message = node.initializer
|
||||
? Diagnostics.Declarations_with_initializers_cannot_also_have_definite_assignment_assertions
|
||||
: Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations;
|
||||
: !node.type
|
||||
? Diagnostics.Declarations_with_definite_assignment_assertions_must_also_have_type_annotations
|
||||
: Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context;
|
||||
return grammarErrorOnNode(node.exclamationToken, message);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user