Skip to content
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/binder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1465,7 +1465,8 @@ namespace ts {
}

// Declare the method/property
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes);
// It's acceptable for multiple prototype property assignments of the same identifier to occur
declareSymbol(funcSymbol.members, funcSymbol, leftSideOfAssignment, SymbolFlags.Property, SymbolFlags.PropertyExcludes & ~SymbolFlags.Property);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adapt the above comment:

// It's acceptable for multiple 'Foo.prototype' assignments of the same prototype to occur

or something like that

}

function bindCallExpression(node: CallExpression) {
Expand Down
28 changes: 28 additions & 0 deletions tests/cases/fourslash/jsDocClasses1.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
///<reference path="fourslash.ts" />

// @allowNonTsExtensions: true

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not think you needed the fourslash test here. a compiler baseline test would have been more appropriate.

// @Filename: Foo.js

//// function fn() {
//// this.foo = 10;
//// }
//// fn.prototype.foo = 14;
//// var x = new fn();
////
//// function fn2() {
//// this.foo = 10;
//// this.foo = 10;
//// }
//// fn2.prototype.foo = 14;
//// fn2.prototype.foo = 14;
//// var y = new fn2();
////
//// function fn3() {
//// this.foo = 10;
//// }
//// fn3.prototype.foo = 14;
//// fn3.prototype.foo = 14;
//// var z = new fn3();

verify.numberOfErrorsInCurrentFile(0);