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
TypeScript Version: 2.0.3
Transferring my project from 1.8.10 to 2.0.3 ran me into a bunch of issues all similar to the following simplified code example (test.ts):
classX<T>{bla(x:()=>T|Z<T>){}}classY<T>{bla(x:()=>T){}}classZ<T>{}functiondoBla<T>(In:T){constx:X<T>|Y<T>|T=newX();if((<X<T>|Y<T>>x).bla)(<X<T>|Y<T>>x).bla(()=>{returnIn;});//<= compiles in 1.8.10, but fails in 2.0.3}
Expected behavior: compiles (as on tsc 1.8.10)
Actual behavior: does not compile on 2.0.3, see below
mk@mk-actifsource:~/tmp$ tsc -v
Version 1.8.10
mk@mk-actifsource:~/tmp$ tsc test.ts
mk@mk-actifsource:~/tmp$ node_modules/.bin/tsc -v
Version 2.0.3
mk@mk-actifsource:~/tmp$ node_modules/.bin/tsc test.ts
src/test.ts(20,26): error TS2349: Cannot invoke an expression whose type lacks a call signature.
I tried to search for similar issues and found #7294, however I am not sure about relevance of that issue.
The text was updated successfully, but these errors were encountered:
It is the same issue, and it is unfortunately an actual breaking change. As mentioned in the comments for #10025, it happened to work in some cases (including yours) because of aggressive subtype reduction, but we need a different approach to actually fix the issue in the general case.
For others finding this ticket: the currently open ticket handling that case seems to be #9104.
BUT: #9104 is itself market as DUPLICATE as well, however, I cannot find, which "not closed" ticket #9104 actually duplicates.
Can you give us a pointer, which open ticket handles the type inference issue?
TypeScript Version: 2.0.3
Transferring my project from 1.8.10 to 2.0.3 ran me into a bunch of issues all similar to the following simplified code example (test.ts):
Expected behavior: compiles (as on tsc 1.8.10)
Actual behavior: does not compile on 2.0.3, see below
I tried to search for similar issues and found #7294, however I am not sure about relevance of that issue.
The text was updated successfully, but these errors were encountered: