2014-10-22 00:32:45 +02:00
|
|
|
tests/cases/compiler/typeArgumentConstraintResolution1.ts(4,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'.
|
2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/typeArgumentConstraintResolution1.ts(11,6): error TS2344: Type 'Date' does not satisfy the constraint 'Number'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/typeArgumentConstraintResolution1.ts (2 errors) ====
|
|
|
|
function foo1<T extends Date>(test: T);
|
|
|
|
function foo1<T extends Number>(test: string);
|
|
|
|
function foo1<T extends String>(test: any) { }
|
|
|
|
foo1<Date>(""); // should error
|
|
|
|
~~~~
|
2014-10-22 00:32:45 +02:00
|
|
|
!!! error TS2344: Type 'Date' does not satisfy the constraint 'Number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function foo2<T extends Date>(test: T): T;
|
|
|
|
function foo2<T extends Number>(test: string): T;
|
|
|
|
function foo2<T extends String>(test: any): any { return null; }
|
|
|
|
foo2<Date>(""); // Type Date does not satisfy the constraint 'Number' for type parameter 'T extends Number'
|
|
|
|
~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2344: Type 'Date' does not satisfy the constraint 'Number'.
|
2014-07-13 01:04:16 +02:00
|
|
|
|