TypeScript/tests/baselines/reference/constructorImplementationWithDefaultValues2.errors.txt

35 lines
1.7 KiB
Plaintext
Raw Normal View History

2014-11-05 21:26:03 +01:00
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(3,17): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,17): error TS2322: Type 'number' is not assignable to type 'T'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(10,27): error TS2322: Type 'T' is not assignable to type 'U'.
tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts(17,17): error TS2322: Type 'Date' is not assignable to type 'T'.
2014-07-13 01:04:16 +02:00
==== tests/cases/conformance/classes/constructorDeclarations/constructorParameters/constructorImplementationWithDefaultValues2.ts (4 errors) ====
class C {
constructor(x);
constructor(public x: string = 1) { // error
~~~~~~~~~~~~~~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'number' is not assignable to type 'string'.
2014-07-13 01:04:16 +02:00
var y = x;
}
}
class D<T, U> {
constructor(x: T, y: U);
constructor(x: T = 1, public y: U = x) { // error
~~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'number' is not assignable to type 'T'.
2014-07-13 01:04:16 +02:00
~~~~~~~~~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'T' is not assignable to type 'U'.
2014-07-13 01:04:16 +02:00
var z = x;
}
}
class E<T extends Date> {
constructor(x);
constructor(x: T = new Date()) { // error
~~~~~~~~~~~~~~~~~
2014-11-05 21:26:03 +01:00
!!! error TS2322: Type 'Date' is not assignable to type 'T'.
2014-07-13 01:04:16 +02:00
var y = x;
}
}