mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Prevent collision of imported type with exported declarations in current module (#31231)
* check for exported type name for conflict * refactor baseline tests for import/export name collision
This commit is contained in:
committed by
Andrew Branch
parent
e72937deff
commit
c0573c59c9
@@ -31965,7 +31965,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function checkAliasSymbol(node: ImportEqualsDeclaration | ImportClause | NamespaceImport | ImportSpecifier | ExportSpecifier) {
|
||||
const symbol = getSymbolOfNode(node);
|
||||
let symbol = getSymbolOfNode(node);
|
||||
const target = resolveAlias(symbol);
|
||||
|
||||
const shouldSkipWithJSExpandoTargets = symbol.flags & SymbolFlags.Assignment;
|
||||
@@ -31976,6 +31976,7 @@ namespace ts {
|
||||
// Based on symbol.flags we can compute a set of excluded meanings (meaning that resolved alias should not have,
|
||||
// otherwise it will conflict with some local declaration). Note that in addition to normal flags we include matching SymbolFlags.Export*
|
||||
// in order to prevent collisions with declarations that were exported from the current module (they still contribute to local names).
|
||||
symbol = getMergedSymbol(symbol.exportSymbol || symbol);
|
||||
const excludedMeanings =
|
||||
(symbol.flags & (SymbolFlags.Value | SymbolFlags.ExportValue) ? SymbolFlags.Value : 0) |
|
||||
(symbol.flags & SymbolFlags.Type ? SymbolFlags.Type : 0) |
|
||||
|
||||
Reference in New Issue
Block a user