Skip to content

Commit 2644f28

Browse files
authoredSep 21, 2022
fix(49200): skip duplicated method declarations (#50609)
1 parent 4d91204 commit 2644f28

5 files changed

+51
-0
lines changed
 

‎src/compiler/checker.ts

+1
Original file line numberDiff line numberDiff line change
@@ -7280,6 +7280,7 @@ namespace ts {
72807280
&& symbol.escapedName !== InternalSymbolName.ExportEquals
72817281
&& !(symbol.flags & SymbolFlags.Prototype)
72827282
&& !(symbol.flags & SymbolFlags.Class)
7283+
&& !(symbol.flags & SymbolFlags.Method)
72837284
&& !isConstMergedWithNSPrintableAsSignatureMerge) {
72847285
if (propertyAsAlias) {
72857286
const createdExport = serializeMaybeAliasAssignment(symbol);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//// [a.js]
2+
export default {
3+
methods: {
4+
foo() { }
5+
}
6+
}
7+
8+
9+
10+
11+
//// [a.d.ts]
12+
declare namespace _default {
13+
namespace methods {
14+
function foo(): void;
15+
}
16+
}
17+
export default _default;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
=== /a.js ===
2+
export default {
3+
methods: {
4+
>methods : Symbol(methods, Decl(a.js, 0, 16))
5+
6+
foo() { }
7+
>foo : Symbol(foo, Decl(a.js, 1, 14))
8+
}
9+
}
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=== /a.js ===
2+
export default {
3+
>{ methods: { foo() { } }} : { methods: { foo(): void; }; }
4+
5+
methods: {
6+
>methods : { foo(): void; }
7+
>{ foo() { } } : { foo(): void; }
8+
9+
foo() { }
10+
>foo : () => void
11+
}
12+
}
13+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// @allowJs: true
2+
// @checkJs: true
3+
// @declaration: true
4+
// @emitDeclarationOnly: true
5+
// @filename: /a.js
6+
export default {
7+
methods: {
8+
foo() { }
9+
}
10+
}

0 commit comments

Comments
 (0)
Please sign in to comment.