Under 'Type arguments in function calls', they say C# and TypeScript can afford some cycles to disambiguate the following code:
return someFunction<A, B>(x)
This is actually a case where TypeScript's promise:> All valid JavaScript code is also TypeScript code. You might get type-checking errors, but that won't stop you from running the resulting JavaScript.
...is broken. The following JavaScript is perfectly valid:
function f(something, other) {
const A = 1;
const B = 2;
return something < A, B > (other + 1);
}
console.log(f(0, 0), f(2, 2));
If you run it in your browser you get 'true false' as output. Passing it through the TypeScript compiler produces the following: function f(something, other) {
const A = 1;
const B = 2;
return something(other + 1);
}
console.log(f(0, 0), f(2, 2));
Trying to run that produces the error 'something is not a function'.TypeScript can get away with things like this because such expressions are weird, rare, and mostly pointless.
The equivalent function in Lua would not be nearly as weird. It would simply return two booleans. There is no clear argument to be made here that the user actually meant a generic function call.