Add missing ambient check to verbatimModuleSyntax export = error (#53385)

This commit is contained in:
Andrew Branch authored and GitHub committed 2023-03-20 12:05:20 -07:00
1 parent 7a8238d88d
commit af00915d71
5 files changed
+64 -6

No files matched your search

+2 -2
View File
@@ -44326,7 +44326,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
if (getAllSymbolFlags(sym) & SymbolFlags.Value) {
// However if it is a value, we need to check it's being used correctly
checkExpressionCached(id);
if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, SymbolFlags.Value)) {
if (!isIllegalExportDefaultInCJS && !(node.flags & NodeFlags.Ambient) && compilerOptions.verbatimModuleSyntax && getTypeOnlyAliasDeclaration(sym, SymbolFlags.Value)) {
error(id,
node.isExportEquals
? Diagnostics.An_export_declaration_must_reference_a_real_value_when_verbatimModuleSyntax_is_enabled_but_0_resolves_to_a_type_only_declaration
@@ -44334,7 +44334,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
idText(id));
}
}
else if (!isIllegalExportDefaultInCJS && compilerOptions.verbatimModuleSyntax) {
else if (!isIllegalExportDefaultInCJS && !(node.flags & NodeFlags.Ambient) && compilerOptions.verbatimModuleSyntax) {
error(id,
node.isExportEquals
? Diagnostics.An_export_declaration_must_reference_a_value_when_verbatimModuleSyntax_is_enabled_but_0_only_refers_to_a_type