diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index caa9f394477..255308b9f54 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -20428,7 +20428,7 @@ namespace ts { if (propType.symbol && propType.symbol.flags & SymbolFlags.Class) { const name = prop.escapedName; const symbol = resolveName(prop.valueDeclaration, name, SymbolFlags.Type, undefined, name, /*isUse*/ false); - if (symbol && propType.symbol !== symbol) { + if (symbol && symbol.declarations.some(d => d.kind === SyntaxKind.JSDocTypedefTag)) { grammarErrorOnNode(symbol.declarations[0], Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name)); return grammarErrorOnNode(prop.valueDeclaration, Diagnostics.Duplicate_identifier_0, unescapeLeadingUnderscores(name)); } diff --git a/tests/baselines/reference/moduleExportAlias4.symbols b/tests/baselines/reference/moduleExportAlias4.symbols new file mode 100644 index 00000000000..859d3eeb0ed --- /dev/null +++ b/tests/baselines/reference/moduleExportAlias4.symbols @@ -0,0 +1,18 @@ +=== tests/cases/conformance/salsa/bug24024.js === +// #24024 +var wat = require('./bug24024') +>wat : Symbol(wat, Decl(bug24024.js, 1, 3)) +>require : Symbol(require) +>'./bug24024' : Symbol("tests/cases/conformance/salsa/bug24024", Decl(bug24024.js, 0, 0)) + +module.exports = class C {} +>module : Symbol(export=, Decl(bug24024.js, 1, 31)) +>exports : Symbol(export=, Decl(bug24024.js, 1, 31)) +>C : Symbol(C, Decl(bug24024.js, 2, 16)) + +module.exports.D = class D { } +>module.exports : Symbol(D, Decl(bug24024.js, 2, 27)) +>module : Symbol(module) +>D : Symbol(D, Decl(bug24024.js, 2, 27)) +>D : Symbol(D, Decl(bug24024.js, 3, 18)) + diff --git a/tests/baselines/reference/moduleExportAlias4.types b/tests/baselines/reference/moduleExportAlias4.types new file mode 100644 index 00000000000..33a7aac2cb4 --- /dev/null +++ b/tests/baselines/reference/moduleExportAlias4.types @@ -0,0 +1,26 @@ +=== tests/cases/conformance/salsa/bug24024.js === +// #24024 +var wat = require('./bug24024') +>wat : typeof C +>require('./bug24024') : typeof C +>require : any +>'./bug24024' : "./bug24024" + +module.exports = class C {} +>module.exports = class C {} : typeof C +>module.exports : any +>module : any +>exports : any +>class C {} : typeof C +>C : typeof C + +module.exports.D = class D { } +>module.exports.D = class D { } : typeof D +>module.exports.D : any +>module.exports : any +>module : any +>exports : any +>D : any +>class D { } : typeof D +>D : typeof D + diff --git a/tests/cases/conformance/salsa/moduleExportAlias4.ts b/tests/cases/conformance/salsa/moduleExportAlias4.ts new file mode 100644 index 00000000000..0572401b802 --- /dev/null +++ b/tests/cases/conformance/salsa/moduleExportAlias4.ts @@ -0,0 +1,8 @@ +// @checkJs: true +// @allowJS: true +// @noEmit: true +// @Filename: bug24024.js +// #24024 +var wat = require('./bug24024') +module.exports = class C {} +module.exports.D = class D { }