mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 11:24:29 -05:00
Error on invalid uses of namespace export (#37715)
This commit is contained in:
@@ -34018,7 +34018,7 @@ namespace ts {
|
||||
return false;
|
||||
}
|
||||
if (inAmbientExternalModule && isExternalModuleNameRelative(moduleName.text)) {
|
||||
// we have already reported errors on top level imports\exports in external module augmentations in checkModuleDeclaration
|
||||
// we have already reported errors on top level imports/exports in external module augmentations in checkModuleDeclaration
|
||||
// no need to do this again.
|
||||
if (!isTopLevelInExternalModuleAugmentation(node)) {
|
||||
// TypeScript 1.0 spec (April 2013): 12.1.6
|
||||
@@ -34154,16 +34154,10 @@ namespace ts {
|
||||
|
||||
checkGrammarExportDeclaration(node);
|
||||
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
|
||||
if (node.exportClause) {
|
||||
if (node.exportClause && !isNamespaceExport(node.exportClause)) {
|
||||
// export { x, y }
|
||||
// export { x, y } from "foo"
|
||||
if (isNamedExports(node.exportClause)) {
|
||||
forEach(node.exportClause.elements, checkExportSpecifier);
|
||||
}
|
||||
else if(!isNamespaceExport(node.exportClause)) {
|
||||
checkImportBinding(node.exportClause);
|
||||
}
|
||||
|
||||
forEach(node.exportClause.elements, checkExportSpecifier);
|
||||
const inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && isAmbientModule(node.parent.parent);
|
||||
const inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === SyntaxKind.ModuleBlock &&
|
||||
!node.moduleSpecifier && node.flags & NodeFlags.Ambient;
|
||||
@@ -34177,7 +34171,9 @@ namespace ts {
|
||||
if (moduleSymbol && hasExportAssignmentSymbol(moduleSymbol)) {
|
||||
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
|
||||
}
|
||||
|
||||
else if (node.exportClause) {
|
||||
checkAliasSymbol(node.exportClause);
|
||||
}
|
||||
if (moduleKind !== ModuleKind.System && moduleKind < ModuleKind.ES2015) {
|
||||
checkExternalEmitHelpers(node, ExternalEmitHelpers.ExportStar);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user