2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/promiseIdentityWithConstraints.ts ===
|
|
|
|
interface IPromise<T, V> {
|
|
|
|
>IPromise : IPromise<T, V>
|
|
|
|
>T : T
|
|
|
|
>V : V
|
|
|
|
|
|
|
|
then<U extends T, W extends V>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
|
|
|
|
>then : <U extends T, W extends V>(callback: (x: T) => IPromise<U, W>) => IPromise<U, W>
|
|
|
|
>U : U
|
|
|
|
>T : T
|
|
|
|
>W : W
|
|
|
|
>V : V
|
|
|
|
>callback : (x: T) => IPromise<U, W>
|
|
|
|
>x : T
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>IPromise : IPromise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>W : W
|
2014-08-19 04:56:03 +02:00
|
|
|
>IPromise : IPromise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>W : W
|
|
|
|
}
|
|
|
|
interface Promise<T, V> {
|
|
|
|
>Promise : Promise<T, V>
|
|
|
|
>T : T
|
|
|
|
>V : V
|
|
|
|
|
|
|
|
then<U extends T, W extends V>(callback: (x: T) => Promise<U, W>): Promise<U, W>;
|
|
|
|
>then : <U extends T, W extends V>(callback: (x: T) => Promise<U, W>) => Promise<U, W>
|
|
|
|
>U : U
|
|
|
|
>T : T
|
|
|
|
>W : W
|
|
|
|
>V : V
|
|
|
|
>callback : (x: T) => Promise<U, W>
|
|
|
|
>x : T
|
|
|
|
>T : T
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>W : W
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>W : W
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error because constraint V doesn't match
|
|
|
|
var x: IPromise<string, number>;
|
|
|
|
>x : IPromise<string, number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>IPromise : IPromise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var x: Promise<string, boolean>;
|
|
|
|
>x : IPromise<string, number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Promise : Promise<T, V>
|
2014-08-15 23:33:16 +02:00
|
|
|
|