Runtime type checking
This example is about type checking and detecting polymorphic argument and return types of functions.
We detect when a function's:
- - argument type changes
- - argument count changes
- - return type changes
- - argument or return value is NaN
Polymorphic arguments are colored yellow
Polymorphic return values are colored red
Reports:
function add(a, b) {
return a + b;
};
add(2, 4); // add is traced as add(a:number, b:number):number
add("Hello", "World"); // add turned polymorphic
add(2 * 2, 0);
add(add(1, add(1, "")), 2 * 8);
add(666, 777);
add(Math.random() > 0.5 ? NaN : 1, 777);