mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
Fix emit of simple module.exports.C.prototype pattern (#37719)
Extends the fix of #36108 so that the simple example gets correct emit; the complex test case I came up with still doesn't work correctly, but the actual code froma #35228 is fixed.
This commit is contained in:
parent
a46e9aea10
commit
4dc827e22a
@ -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.
|
||||
|
||||
@ -21,4 +21,6 @@ module.exports.MyClass.prototype = {
|
||||
|
||||
|
||||
//// [jsDeclarationsExportAssignedConstructorFunction.d.ts]
|
||||
export {};
|
||||
export class MyClass {
|
||||
a: () => void;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user