Fix export of enum with same-named member (#55070)

This commit is contained in:
Ron Buckton
2023-07-19 15:52:19 -04:00
committed by GitHub
parent 8f96638692
commit 97ef321fa0
4 changed files with 85 additions and 2 deletions

View File

@@ -3040,8 +3040,8 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
// (it refers to the constant type of the expression instead)
return undefined;
}
if (isModuleDeclaration(location) && lastLocation && location.name === lastLocation) {
// If this is the name of a namespace, skip the parent since it will have is own locals that could
if (isModuleOrEnumDeclaration(location) && lastLocation && location.name === lastLocation) {
// If lastLocation is the name of a namespace or enum, skip the parent since it will have is own locals that could
// conflict.
lastLocation = location;
location = location.parent;