TypeScript/tests/baselines/reference/returnInConstructor1.errors.txt
2014-09-12 13:35:07 -07:00

81 lines
2.3 KiB
Plaintext

tests/cases/compiler/returnInConstructor1.ts(11,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/compiler/returnInConstructor1.ts(25,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/compiler/returnInConstructor1.ts(39,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
tests/cases/compiler/returnInConstructor1.ts(55,16): error TS2409: Return type of constructor signature must be assignable to the instance type of the class
==== tests/cases/compiler/returnInConstructor1.ts (4 errors) ====
class A {
foo() { }
constructor() {
return;
}
}
class B {
foo() { }
constructor() {
return 1; // error
~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
}
class C {
foo() { }
constructor() {
return this;
}
}
class D {
foo() { }
constructor() {
return "test"; // error
~~~~~~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
}
class E {
public foo: number;
constructor() {
return { foo: 1 };
}
}
class F {
public foo: string;
constructor() {
return { foo: 1 }; //error
~~~~~~~~~~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
}
class G {
private test: number;
public test1() { }
foo() { }
constructor() {
this.test = 2;
}
}
class H extends F {
constructor() {
super();
return new G(); //error
~~~~~~~
!!! error TS2409: Return type of constructor signature must be assignable to the instance type of the class
}
}
class I extends G {
constructor() {
super();
return new G();
}
}