TypeScript/tests/cases/conformance/salsa/inferringClassMembersFromAssignments5.ts
Nathan Shively-Sanders 1541599ea0
Check base type for special property declarations (#23671)
If the base type has a property by that name, add it to the list
constructor types to make it as authoritative as special assignments
found in the constructor.
2018-04-26 08:14:22 -07:00

22 lines
383 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @strictNullChecks: true
// @Filename: a.js
class Base {
m() {
this.p = 1
}
}
class Derived extends Base {
constructor() {
super();
// should be OK, and p should have type number from this assignment
this.p = 1
}
test() {
return this.p
}
}