diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index eec6b03dddc..3ba610453c0 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -5648,7 +5648,7 @@ namespace ts { serializeEnum(symbol, symbolName, modifierFlags); } if (symbol.flags & SymbolFlags.Class) { - if (symbol.flags & SymbolFlags.Property) { + if (symbol.flags & SymbolFlags.Property && isBinaryExpression(symbol.valueDeclaration.parent) && isClassExpression(symbol.valueDeclaration.parent.right)) { // Looks like a `module.exports.Sub = class {}` - if we serialize `symbol` as a class, the result will have no members, // since the classiness is actually from the target of the effective alias the symbol is. yes. A BlockScopedVariable|Class|Property // _really_ acts like an Alias, and none of a BlockScopedVariable, Class, or Property. This is the travesty of JS binding today. diff --git a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunction.js b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunction.js index aa2f0d2a0a9..747a2627d42 100644 --- a/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunction.js +++ b/tests/baselines/reference/jsDeclarationsExportAssignedConstructorFunction.js @@ -21,4 +21,6 @@ module.exports.MyClass.prototype = { //// [jsDeclarationsExportAssignedConstructorFunction.d.ts] -export {}; +export class MyClass { + a: () => void; +}