@@ -5971,7 +5971,7 @@ namespace ts {
5971
5971
}
5972
5972
5973
5973
function getNamespaceMembersForSerialization(symbol: Symbol) {
5974
- return !symbol.exports ? [] : filter(arrayFrom(( symbol.exports) .values()), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype")) );
5974
+ return !symbol.exports ? [] : filter(arrayFrom(symbol.exports.values()), isNamespaceMember );
5975
5975
}
5976
5976
5977
5977
function isTypeOnlyNamespace(symbol: Symbol) {
@@ -6103,7 +6103,7 @@ namespace ts {
6103
6103
}
6104
6104
// Module symbol emit will take care of module-y members, provided it has exports
6105
6105
if (!(symbol.flags & (SymbolFlags.ValueModule | SymbolFlags.NamespaceModule) && !!symbol.exports && !!symbol.exports.size)) {
6106
- const props = filter(getPropertiesOfType(type), p => !((p.flags & SymbolFlags.Prototype) || (p.escapedName === "prototype")) );
6106
+ const props = filter(getPropertiesOfType(type), isNamespaceMember );
6107
6107
serializeAsNamespaceDeclaration(props, localName, modifierFlags, /*suppressNewPrivateContext*/ true);
6108
6108
}
6109
6109
}
@@ -6159,6 +6159,10 @@ namespace ts {
6159
6159
}
6160
6160
}
6161
6161
6162
+ function isNamespaceMember(p: Symbol) {
6163
+ return !(p.flags & SymbolFlags.Prototype || p.escapedName === "prototype" || p.valueDeclaration && isClassLike(p.valueDeclaration.parent));
6164
+ }
6165
+
6162
6166
function serializeAsClass(symbol: Symbol, localName: string, modifierFlags: ModifierFlags) {
6163
6167
const localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
6164
6168
const typeParamDecls = map(localParams, p => typeParameterToDeclaration(p, context));
@@ -6195,12 +6199,9 @@ namespace ts {
6195
6199
emptyArray;
6196
6200
const publicProperties = flatMap<Symbol, ClassElement>(publicSymbolProps, p => serializePropertySymbolForClass(p, /*isStatic*/ false, baseTypes[0]));
6197
6201
// Consider static members empty if symbol also has function or module meaning - function namespacey emit will handle statics
6198
- const staticMembers = symbol.flags & (SymbolFlags.Function | SymbolFlags.ValueModule)
6199
- ? []
6200
- : flatMap(filter(
6201
- getPropertiesOfType(staticType),
6202
- p => !(p.flags & SymbolFlags.Prototype) && p.escapedName !== "prototype"
6203
- ), p => serializePropertySymbolForClass(p, /*isStatic*/ true, staticBaseType));
6202
+ const staticMembers = flatMap(
6203
+ filter(getPropertiesOfType(staticType), p => !(p.flags & SymbolFlags.Prototype) && p.escapedName !== "prototype" && !isNamespaceMember(p)),
6204
+ p => serializePropertySymbolForClass(p, /*isStatic*/ true, staticBaseType));
6204
6205
const constructors = serializeSignatures(SignatureKind.Construct, staticType, baseTypes[0], SyntaxKind.Constructor) as ConstructorDeclaration[];
6205
6206
for (const c of constructors) {
6206
6207
// A constructor's return type and type parameters are supposed to be controlled by the enclosing class declaration
@@ -6363,7 +6364,7 @@ namespace ts {
6363
6364
includePrivateSymbol(referenced || target);
6364
6365
}
6365
6366
6366
- // We disable the context's symbol traker for the duration of this name serialization
6367
+ // We disable the context's symbol tracker for the duration of this name serialization
6367
6368
// as, by virtue of being here, the name is required to print something, and we don't want to
6368
6369
// issue a visibility error on it. Only anonymous classes that an alias points at _would_ issue
6369
6370
// a visibility error here (as they're not visible within any scope), but we want to hoist them
@@ -6479,10 +6480,11 @@ namespace ts {
6479
6480
// need to be merged namespace members
6480
6481
return [];
6481
6482
}
6482
- if (p.flags & SymbolFlags.Prototype || (baseType && getPropertyOfType(baseType, p.escapedName)
6483
- && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)!) === isReadonlySymbol(p)
6484
- && (p.flags & SymbolFlags.Optional) === (getPropertyOfType(baseType, p.escapedName)!.flags & SymbolFlags.Optional)
6485
- && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)!))) {
6483
+ if (p.flags & SymbolFlags.Prototype ||
6484
+ (baseType && getPropertyOfType(baseType, p.escapedName)
6485
+ && isReadonlySymbol(getPropertyOfType(baseType, p.escapedName)!) === isReadonlySymbol(p)
6486
+ && (p.flags & SymbolFlags.Optional) === (getPropertyOfType(baseType, p.escapedName)!.flags & SymbolFlags.Optional)
6487
+ && isTypeIdenticalTo(getTypeOfSymbol(p), getTypeOfPropertyOfType(baseType, p.escapedName)!))) {
6486
6488
return [];
6487
6489
}
6488
6490
const flag = (modifierFlags & ~ModifierFlags.Async) | (isStatic ? ModifierFlags.Static : 0);
0 commit comments