-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScript
Milestone
Description
The following code used to type-check fine (Using the types for Promises prior to: DefinitelyTyped/DefinitelyTyped@c95561b ), but since they now use types based on: https://github.com/Microsoft/TypeScript/blob/master/src/lib/es6.d.ts#L3542
the code produces false type errors.
/// <reference path='es6-promise.d.ts' />
interface T1 {
__t1: string;
}
interface T2 {
__t2: string;
}
interface T3 {
__t3: string;
}
function f1() : Promise<T1> {
return Promise.resolve({ __t1: "foo_t1" });
}
function f2(x:T1) : T2 {
return { __t2: x.__t1 + ":foo_21" };
}
var x3 = f1()
.then(f2, (e:Error) => {
console.log("error 1");
throw e;
})
.then((x:T2) => {
return { __t3: x.__t2 + "bar" };
});
It gives these errors (in TypeScript 1.4.1):
promise-oddity.ts(23,10): error TS2453:
The type argument for type parameter 'U' cannot be inferred from the usage.
Consider specifying the type arguments explicitly.
Type argument candidate 'T2' is not a valid type argument
because it is not a supertype of candidate 'void'.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScript