TypeScript/tests/cases/compiler/overrideBaseIntersectionMethod.ts
Anders Hejlsberg dd84d7ca48 Add repro
2017-03-13 13:24:14 -07:00

32 lines
616 B
TypeScript

// @strict: true
// Repro from #14615
type Constructor<T> = new (...args: any[]) => T;
const WithLocation = <T extends Constructor<Point>>(Base: T) => class extends Base {
getLocation(): [number, number] {
const [x,y] = super.getLocation();
return [this.x | x, this.y | y];
}
}
class Point {
constructor(public x: number, public y: number) { }
getLocation(): [number, number] {
return [0,0];
}
}
class Foo extends WithLocation(Point) {
calculate() {
return this.x + this.y;
}
getLocation() {
return super.getLocation()
}
whereAmI() {
return this.getLocation();
}
}