You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
function g<a, b, r>(f: (one: a, two: b) => r, one: a, two: b) {
return f(one, two);
}
function f(text: string, index: number) { return text.substr(index); }
alert(g(f, 'hey', 1)); // <-- compiles and works
alert(g(f, 1, 'hey')); // <-- a problem: compiles but crashes at runtime
// expected: compilation error, `f` expects a string and a number, not an empty type value
// actual: all arguments are resolved to empty type values which are not what the funciton `f` is designed to accept
at playground
The text was updated successfully, but these errors were encountered: