The check for prototype assignment on constructor functions assumes that the prototype property, if present, comes from an assignment declaration, such as: ```js SomeClass.prototype = { /* methods go here */ } ``` In this case, however, when class SomeClass and var SomeClass merge (because this is allowed), prototype is the synthetic property from class SomeClass, which has no valueDeclaration. The fix is to check that prototype has a valueDeclaration before checking whether the valueDeclaration is in fact a prototype-assignment declaration.
14 lines
215 B
TypeScript
14 lines
215 B
TypeScript
// @allowJs: true
|
|
// @noEmit: true
|
|
// @checkJs: true
|
|
|
|
// @Filename: file1.js
|
|
var SomeClass = function () {
|
|
this.otherProp = 0;
|
|
};
|
|
|
|
new SomeClass();
|
|
|
|
// @Filename: file2.js
|
|
class SomeClass { }
|
|
SomeClass.prop = 0
|