mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Fix false verbatimModuleSyntax error on export namespace in ESM (#52555)
This commit is contained in:
@@ -43344,7 +43344,10 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
|
||||
getNodeLinks(node).flags |= NodeCheckFlags.LexicalModuleMergesWithClass;
|
||||
}
|
||||
}
|
||||
if (compilerOptions.verbatimModuleSyntax && node.parent.kind === SyntaxKind.SourceFile) {
|
||||
if (compilerOptions.verbatimModuleSyntax &&
|
||||
node.parent.kind === SyntaxKind.SourceFile &&
|
||||
(moduleKind === ModuleKind.CommonJS || node.parent.impliedNodeFormat === ModuleKind.CommonJS)
|
||||
) {
|
||||
const exportModifier = node.modifiers?.find(m => m.kind === SyntaxKind.ExportKeyword);
|
||||
if (exportModifier) {
|
||||
error(exportModifier, Diagnostics.A_top_level_export_modifier_cannot_be_used_on_value_declarations_in_a_CommonJS_module_when_verbatimModuleSyntax_is_enabled);
|
||||
|
||||
Reference in New Issue
Block a user