-
Notifications
You must be signed in to change notification settings - Fork 12.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type inference has failed by parameter order (regression) #19858
Comments
c:\test\sandbox7>type a.ts
declare function f<a>(as1: a[], as2: a[], cmp: (a1: a, a2: a) => number): void;
f(Array.from([0]), [], (a1, a2) => a1 - a2);
f(Array.from([]), [0], (a1, a2) => a1 - a2);
c:\test\sandbox7>tsc --v
Version 2.7.0-dev.20171109
c:\test\sandbox7>tsc a.ts --lib es6
c:\test\sandbox7>echo %ERRORLEVEL%
0 |
I think your example is not correct, and you are looking at a result of #19745. |
You have to enable strictNullChecks option. |
Seems like your are right but this result is bad. @ahejlsberg Is this your intended result? |
#19745 fixes a legitimate issue. However, I do agree that the exhibited behaviour here is also a bug. The problem is that
Currently the call to In any case, the root cause is #9366. |
It is indeed a regression caused by #19745 where we make no inferences from the |
Thanks! |
Intended degradation?
cc @ahejlsberg
TypeScript Version: master
Code
Expected behavior:
no error
Actual behavior:
The text was updated successfully, but these errors were encountered: