Skip to content

Ensure type/namespaceish statics are included in the list of namespace merge members #38920

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6510,7 +6510,8 @@ namespace ts {
}

function isNamespaceMember(p: Symbol) {
return !(p.flags & SymbolFlags.Prototype || p.escapedName === "prototype" || p.valueDeclaration && isClassLike(p.valueDeclaration.parent));
return !!(p.flags & (SymbolFlags.Type | SymbolFlags.Namespace | SymbolFlags.Alias)) ||
!(p.flags & SymbolFlags.Prototype || p.escapedName === "prototype" || p.valueDeclaration && isClassLike(p.valueDeclaration.parent));
}

function serializeAsClass(symbol: Symbol, localName: string, modifierFlags: ModifierFlags) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//// [source.js]
export class Clazz {
static method() { }
}

Clazz.method.prop = 5;

//// [source.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Clazz = void 0;
var Clazz = /** @class */ (function () {
function Clazz() {
}
Clazz.method = function () { };
return Clazz;
}());
exports.Clazz = Clazz;
Clazz.method.prop = 5;


//// [source.d.ts]
export class Clazz {
}
export namespace Clazz {
function method(): void;
namespace method {
const prop: number;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
=== tests/cases/conformance/jsdoc/declarations/source.js ===
export class Clazz {
>Clazz : Symbol(Clazz, Decl(source.js, 0, 0), Decl(source.js, 2, 1))

static method() { }
>method : Symbol(Clazz.method, Decl(source.js, 0, 20), Decl(source.js, 4, 6))
}

Clazz.method.prop = 5;
>Clazz.method.prop : Symbol(Clazz.method.prop, Decl(source.js, 2, 1))
>Clazz.method : Symbol(Clazz.method, Decl(source.js, 0, 20), Decl(source.js, 4, 6))
>Clazz : Symbol(Clazz, Decl(source.js, 0, 0), Decl(source.js, 2, 1))
>method : Symbol(Clazz.method, Decl(source.js, 0, 20), Decl(source.js, 4, 6))
>prop : Symbol(Clazz.method.prop, Decl(source.js, 2, 1))

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
=== tests/cases/conformance/jsdoc/declarations/source.js ===
export class Clazz {
>Clazz : Clazz

static method() { }
>method : typeof Clazz.method
}

Clazz.method.prop = 5;
>Clazz.method.prop = 5 : 5
>Clazz.method.prop : number
>Clazz.method : typeof Clazz.method
>Clazz : typeof Clazz
>method : typeof Clazz.method
>prop : number
>5 : 5

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// @allowJs: true
// @checkJs: true
// @target: es5
// @outDir: ./out
// @declaration: true
// @filename: source.js
export class Clazz {
static method() { }
}

Clazz.method.prop = 5;