|
| 1 | +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(24,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 2 | +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(53,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 3 | +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(69,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 4 | +tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts(85,38): error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'. |
| 5 | + |
| 6 | + |
| 7 | +==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallToOverloadedMethodWithOverloadedArguments.ts (4 errors) ==== |
| 8 | + |
| 9 | + module m1 { |
| 10 | + interface Promise<T> { |
| 11 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 12 | + } |
| 13 | + |
| 14 | + declare function testFunction(n: number): Promise<number>; |
| 15 | + |
| 16 | + var numPromise: Promise<number>; |
| 17 | + var newPromise = numPromise.then(testFunction); |
| 18 | + } |
| 19 | + |
| 20 | + ////////////////////////////////////// |
| 21 | + |
| 22 | + module m2 { |
| 23 | + interface Promise<T> { |
| 24 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 25 | + } |
| 26 | + |
| 27 | + declare function testFunction(n: number): Promise<number>; |
| 28 | + declare function testFunction(s: string): Promise<string>; |
| 29 | + |
| 30 | + var numPromise: Promise<number>; |
| 31 | + var newPromise = numPromise.then(testFunction); |
| 32 | + ~~~~~~~~~~~~ |
| 33 | +!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 34 | + } |
| 35 | + |
| 36 | + ////////////////////////////////////// |
| 37 | + |
| 38 | + module m3 { |
| 39 | + interface Promise<T> { |
| 40 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 41 | + then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; |
| 42 | + } |
| 43 | + |
| 44 | + declare function testFunction(n: number): Promise<number>; |
| 45 | + |
| 46 | + var numPromise: Promise<number>; |
| 47 | + var newPromise = numPromise.then(testFunction); |
| 48 | + } |
| 49 | + |
| 50 | + ////////////////////////////////////// |
| 51 | + |
| 52 | + module m4 { |
| 53 | + interface Promise<T> { |
| 54 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 55 | + then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; |
| 56 | + } |
| 57 | + |
| 58 | + declare function testFunction(n: number): Promise<number>; |
| 59 | + declare function testFunction(s: string): Promise<string>; |
| 60 | + |
| 61 | + var numPromise: Promise<number>; |
| 62 | + var newPromise = numPromise.then(testFunction); |
| 63 | + ~~~~~~~~~~~~ |
| 64 | +!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 65 | + } |
| 66 | + |
| 67 | + ////////////////////////////////////// |
| 68 | + |
| 69 | + module m5 { |
| 70 | + interface Promise<T> { |
| 71 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 72 | + then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; |
| 73 | + then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => U, progress?: (preservation: any) => void): Promise<U>; |
| 74 | + } |
| 75 | + |
| 76 | + declare function testFunction(n: number): Promise<number>; |
| 77 | + declare function testFunction(s: string): Promise<string>; |
| 78 | + |
| 79 | + var numPromise: Promise<number>; |
| 80 | + var newPromise = numPromise.then(testFunction); |
| 81 | + ~~~~~~~~~~~~ |
| 82 | +!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; }' is not assignable to parameter of type '(x: number) => Promise<string>'. |
| 83 | + } |
| 84 | + |
| 85 | + ////////////////////////////////////// |
| 86 | + |
| 87 | + module m6 { |
| 88 | + interface Promise<T> { |
| 89 | + then<U>(cb: (x: T) => Promise<U>): Promise<U>; |
| 90 | + then<U>(cb: (x: T) => Promise<U>, error?: (error: any) => Promise<U>): Promise<U>; |
| 91 | + } |
| 92 | + |
| 93 | + declare function testFunction(n: number): Promise<number>; |
| 94 | + declare function testFunction(s: string): Promise<string>; |
| 95 | + declare function testFunction(b: boolean): Promise<boolean>; |
| 96 | + |
| 97 | + var numPromise: Promise<number>; |
| 98 | + var newPromise = numPromise.then(testFunction); |
| 99 | + ~~~~~~~~~~~~ |
| 100 | +!!! error TS2345: Argument of type '{ (n: number): Promise<number>; (s: string): Promise<string>; (b: boolean): Promise<boolean>; }' is not assignable to parameter of type '(x: number) => Promise<boolean>'. |
| 101 | + } |
| 102 | + |
0 commit comments