2 ms·
It seems the analyser to infer the types of your vars is fairly easily fooled. The following code compiles, but prints out "Hello undefined": interface per
by luke_s 14y ago
It seems the analyser to infer the types of your vars is fairly easily fooled. The following code compiles, but prints out "Hello undefined":
interface person{
firstname;
lastname;
}
interface apple{
colour;
}
function hello(p : person){
alert("hello " + p.firstname);
}
var aPerson = {firstname: "joe", lastname : "blogs"};
var anApple = {color: "red"};
var foo;
if(true){
foo = anApple;
}
hello(foo);
- wingspan 14y agoWhen you paste this into the Playground, and hover over the `var