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

18 lines
776 B
Plaintext

==== 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
~~~~
!!! Type 'Date' does not satisfy the constraint 'Number':
!!! Property 'toFixed' is missing in type 'Date'.
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'
~~~~
!!! Type 'Date' does not satisfy the constraint 'Number'.