TypeScript/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt
2014-09-11 16:11:08 -07:00

29 lines
1,010 B
Plaintext

==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts (4 errors) ====
class C {
constructor(x);
constructor(public x: string = 1) { // error
~~~~~~~~~~~~~~~~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'string'.
var y = x;
}
}
class D<T, U> {
constructor(x: T, y: U);
constructor(x: T = 1, public y: U = x) { // error
~~~~~~~~
!!! error TS2323: Type 'number' is not assignable to type 'T'.
~~~~~~~~~~~~~~~
!!! error TS2323: Type 'T' is not assignable to type 'U'.
var z = x;
}
}
class E<T extends Date> {
constructor(x);
constructor(x: T = new Date()) { // error
~~~~~~~~~~~~~~~~~
!!! error TS2323: Type 'Date' is not assignable to type 'T'.
var y = x;
}
}