Keep Disallowing return in ambient locations

This commit is contained in:
Nathan Shively-Sanders
2022-05-02 11:18:00 -07:00
parent 2056e13d52
commit 714ea8e524
2 changed files with 5 additions and 2 deletions

View File

@@ -38913,7 +38913,7 @@ namespace ts {
}
if (!container) {
if (!!getSourceFileOfNode(node).externalModuleIndicator) {
if (!!getSourceFileOfNode(node).externalModuleIndicator || node.flags & NodeFlags.Ambient) {
grammarErrorOnFirstToken(node, Diagnostics.A_return_statement_can_only_be_used_within_a_function_body);
}
return;