Breaking change interpreting jquery promise types #22362
Copy link
Copy link
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 2.8.0-dev.20180302
Code
/// <reference types="jquery" /> // version 3.3.0
const t: JQuery.Promise2<string, Error, number, boolean, any, any> = {} as any;
$.when(t).then((a, b) => {
const s: 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.)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
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.