TypeScript/tests/baselines/reference/destructuringParameterProperties4.js

54 lines
1.1 KiB
TypeScript
Raw Normal View History

2015-01-14 23:20:32 +01:00
//// [destructuringParameterProperties4.ts]
2015-01-14 01:06:34 +01:00
class C1<T, U, V> {
constructor(private k: T, protected [a, b, c]: [T,U,V]) {
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
public getA() {
return this.a
}
public getB() {
return this.b
}
public getC() {
return this.c;
}
}
class C2 extends C1<number, string, boolean> {
public doSomethingWithSuperProperties() {
2015-01-14 02:45:02 +01:00
return `${this.a} ${this.b} ${this.c}`;
2015-01-14 01:06:34 +01:00
}
}
2015-01-14 23:20:32 +01:00
//// [destructuringParameterProperties4.js]
2015-03-16 00:29:41 +01:00
class C1 {
constructor(k, [a, b, c]) {
2015-01-14 01:06:34 +01:00
this.k = k;
this.[a, b, c] = [a, b, c];
if ((b === undefined && c === undefined) || (this.b === undefined && this.c === undefined)) {
this.a = a || k;
}
}
2015-03-16 00:29:41 +01:00
getA() {
2015-01-14 01:06:34 +01:00
return this.a;
2015-03-16 00:29:41 +01:00
}
getB() {
2015-01-14 01:06:34 +01:00
return this.b;
2015-03-16 00:29:41 +01:00
}
getC() {
2015-01-14 01:06:34 +01:00
return this.c;
}
2015-03-16 00:29:41 +01:00
}
class C2 extends C1 {
doSomethingWithSuperProperties() {
2015-01-14 02:45:02 +01:00
return `${this.a} ${this.b} ${this.c}`;
2015-03-16 00:29:41 +01:00
}
}