2014-11-05 21:26:03 +01:00
|
|
|
tests/cases/compiler/numberToString.ts(2,12): error TS2322: Type 'number' is not assignable to type 'string'.
|
2014-09-12 22:35:07 +02:00
|
|
|
tests/cases/compiler/numberToString.ts(9,4): error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
|
|
|
|
|
|
|
|
2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/numberToString.ts (2 errors) ====
|
|
|
|
function f1(n:number):string {
|
|
|
|
return n; // error return type mismatch
|
|
|
|
~
|
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
|
|
|
}
|
|
|
|
|
|
|
|
function f2(s:string):void {
|
|
|
|
}
|
|
|
|
|
|
|
|
f1(3);
|
|
|
|
f2(3); // error no coercion to string
|
2014-07-25 02:00:03 +02:00
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'string'.
|
2014-07-13 01:04:16 +02:00
|
|
|
f2(3+""); // ok + operator promotes
|
|
|
|
|