2014-07-13 01:04:16 +02:00
|
|
|
//// [promiseIdentityWithConstraints.ts]
|
|
|
|
interface IPromise<T, V> {
|
|
|
|
then<U extends T, W extends V>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
|
|
|
|
}
|
|
|
|
interface Promise<T, V> {
|
|
|
|
then<U extends T, W extends V>(callback: (x: T) => Promise<U, W>): Promise<U, W>;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error because constraint V doesn't match
|
|
|
|
var x: IPromise<string, number>;
|
|
|
|
var x: Promise<string, boolean>;
|
|
|
|
|
|
|
|
//// [promiseIdentityWithConstraints.js]
|
2014-08-12 00:54:12 +02:00
|
|
|
// Error because constraint V doesn't match
|
2014-07-13 01:04:16 +02:00
|
|
|
var x;
|
|
|
|
var x;
|