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
/// <reference types="jquery" /> // version 3.3.0constt: JQuery.Promise2<string,Error,number,boolean,any,any>={}asany;$.when(t).then((a,b)=>{consts: string=b;//should fail!});
Expected behavior:
Error: b is boolean.
Actual behavior:
No error: b is any.
Has expected behavior in 2.8.0-dev.20180301, but behavior changed in 2.8.0-dev.20180302.
There are some additional error locations on DefinitelyTyped -- just run dtslint --installAll (to ensure you're using typescript@next), then dtslint types jquery. (The errors don't reproduce with just tsc because they come from // $ExpectType assertions.)
Specifically, here is the breaking change, added at the very top of inferFromTypes.
if(source.flags&TypeFlags.Any){// We are inferring from an 'any' type. We want to infer this type for every type parameter// referenced in the target type, so we record it as the propagation type and infer from the// target to itself. Then, as we find candidates we substitute the propagation type.constsavePropagationType=propagationType;propagationType=source;inferFromTypes(target,target);propagationType=savePropagationType;return;}
This propagationType is then used in place of the current source when it is available. This adds 'any' for all type parameter found in the structure of the target type.
Activity
RyanCavanaugh commentedon Mar 20, 2018
Andy (Andrewkraft) (@Andy-MS) can you get to the root of this and see if it's something we need to fix on our side before 2.8 goes out?
RyanCavanaugh commentedon Mar 20, 2018
Confirmed regression 2.7 -> 2.8. Worked in all prior releases
sandersn commentedon Mar 20, 2018
Specifically, here is the breaking change, added at the very top of inferFromTypes.
This propagationType is then used in place of the current source when it is available. This adds 'any' for all type parameter found in the structure of the target type.