mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Forbid non-null assertion in '.js' files (#17481)
This commit is contained in:
@@ -16384,6 +16384,10 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkNonNullAssertion(node: NonNullExpression) {
|
||||
if (isInJavaScriptFile(node)) {
|
||||
error(node, Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file);
|
||||
}
|
||||
|
||||
return getNonNullableType(checkExpression(node.expression));
|
||||
}
|
||||
|
||||
|
||||
@@ -3459,6 +3459,10 @@
|
||||
"category": "Error",
|
||||
"code": 8012
|
||||
},
|
||||
"'non-null assertions' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8013
|
||||
},
|
||||
"'enum declarations' can only be used in a .ts file.": {
|
||||
"category": "Error",
|
||||
"code": 8015
|
||||
|
||||
Reference in New Issue
Block a user