TypeScript/tests/cases/conformance/salsa/typeFromPropertyAssignment23.ts
Nathan Shively-Sanders c4a504b3ce
Prototype assignments count as method-like (#23137)
* Prototype assignments count as method-like

For the purposes of reporting prototype/instance property conflicts

* Fix lint
2018-04-04 11:03:31 -07:00

38 lines
658 B
TypeScript

// @noEmit: true
// @checkJs: true
// @allowJs: true
// @Filename: a.js
class B {
constructor () {
this.n = 1
}
foo() {
}
}
class C extends B { }
// this override should be fine (even if it's a little odd)
C.prototype.foo = function() {
}
class D extends B { }
D.prototype.foo = () => {
this.n = 'not checked, so no error'
}
// post-class prototype assignments are trying to show that these properties are abstract
class Module {
}
Module.prototype.identifier = undefined
Module.prototype.size = null
class NormalModule extends Module {
identifier() {
return 'normal'
}
size() {
return 0
}
}