1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
|
=== tests/cases/compiler/promiseIdentityWithAny2.ts ===
export interface IPromise<T, V> {
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny2.ts, 0, 0))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 0, 26))
>V : Symbol(V, Decl(promiseIdentityWithAny2.ts, 0, 28))
then<U, W>(callback: (x: T) => IPromise<U, W>): IPromise<U, W>;
>then : Symbol(IPromise.then, Decl(promiseIdentityWithAny2.ts, 0, 33))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 1, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 1, 11))
>callback : Symbol(callback, Decl(promiseIdentityWithAny2.ts, 1, 15))
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 1, 26))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 0, 26))
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny2.ts, 0, 0))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 1, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 1, 11))
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny2.ts, 0, 0))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 1, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 1, 11))
}
interface Promise<T, V> {
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny2.ts, 2, 1))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 3, 18))
>V : Symbol(V, Decl(promiseIdentityWithAny2.ts, 3, 20))
then(callback: (x: T) => Promise<any, any>): Promise<any, any>;
>then : Symbol(Promise.then, Decl(promiseIdentityWithAny2.ts, 3, 25))
>callback : Symbol(callback, Decl(promiseIdentityWithAny2.ts, 4, 9))
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 4, 20))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 3, 18))
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny2.ts, 2, 1))
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny2.ts, 2, 1))
}
// Error because type parameter arity doesn't match
var x: IPromise<string, number>;
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 8, 3), Decl(promiseIdentityWithAny2.ts, 9, 3))
>IPromise : Symbol(IPromise, Decl(promiseIdentityWithAny2.ts, 0, 0))
var x: Promise<string, boolean>;
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 8, 3), Decl(promiseIdentityWithAny2.ts, 9, 3))
>Promise : Symbol(Promise, Decl(promiseIdentityWithAny2.ts, 2, 1))
interface IPromise2<T, V> {
>IPromise2 : Symbol(IPromise2, Decl(promiseIdentityWithAny2.ts, 9, 32))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 12, 20))
>V : Symbol(V, Decl(promiseIdentityWithAny2.ts, 12, 22))
then<U, W>(callback: (x: T) => IPromise2<U, W>): IPromise2<U, W>;
>then : Symbol(IPromise2.then, Decl(promiseIdentityWithAny2.ts, 12, 27))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 13, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 13, 11))
>callback : Symbol(callback, Decl(promiseIdentityWithAny2.ts, 13, 15))
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 13, 26))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 12, 20))
>IPromise2 : Symbol(IPromise2, Decl(promiseIdentityWithAny2.ts, 9, 32))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 13, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 13, 11))
>IPromise2 : Symbol(IPromise2, Decl(promiseIdentityWithAny2.ts, 9, 32))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 13, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 13, 11))
}
interface Promise2<T, V> {
>Promise2 : Symbol(Promise2, Decl(promiseIdentityWithAny2.ts, 14, 1))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 15, 19))
>V : Symbol(V, Decl(promiseIdentityWithAny2.ts, 15, 21))
then<U, W>(callback: (x: T) => Promise2<string, any>): Promise2<any, any>; // Uses string instead of any!
>then : Symbol(Promise2.then, Decl(promiseIdentityWithAny2.ts, 15, 26))
>U : Symbol(U, Decl(promiseIdentityWithAny2.ts, 16, 9))
>W : Symbol(W, Decl(promiseIdentityWithAny2.ts, 16, 11))
>callback : Symbol(callback, Decl(promiseIdentityWithAny2.ts, 16, 15))
>x : Symbol(x, Decl(promiseIdentityWithAny2.ts, 16, 26))
>T : Symbol(T, Decl(promiseIdentityWithAny2.ts, 15, 19))
>Promise2 : Symbol(Promise2, Decl(promiseIdentityWithAny2.ts, 14, 1))
>Promise2 : Symbol(Promise2, Decl(promiseIdentityWithAny2.ts, 14, 1))
}
// Error because string and any don't match
var y: IPromise2<string, number>;
>y : Symbol(y, Decl(promiseIdentityWithAny2.ts, 20, 3), Decl(promiseIdentityWithAny2.ts, 21, 3))
>IPromise2 : Symbol(IPromise2, Decl(promiseIdentityWithAny2.ts, 9, 32))
var y: Promise2<string, boolean>;
>y : Symbol(y, Decl(promiseIdentityWithAny2.ts, 20, 3), Decl(promiseIdentityWithAny2.ts, 21, 3))
>Promise2 : Symbol(Promise2, Decl(promiseIdentityWithAny2.ts, 14, 1))
|