TypeScript/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt
2014-07-12 17:30:19 -07:00

29 lines
954 B
Plaintext

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