TypeScript/tests/cases/compiler/numberToString.ts

11 lines
201 B
TypeScript
Raw Normal View History

2014-07-13 01:04:16 +02:00
function f1(n:number):string {
return n; // error return type mismatch
}
function f2(s:string):void {
}
f1(3);
f2(3); // error no coercion to string
f2(3+""); // ok + operator promotes