TypeScript/tests/baselines/reference/promiseIdentityWithConstraints.js
2014-07-12 17:30:19 -07:00

16 lines
445 B
JavaScript

//// [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]
var x;
var x;