File: genericCallbackInvokedInsideItsContainingFunction1.errors.txt

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (48 lines) | stat: -rw-r--r-- 2,927 bytes parent folder | download | duplicates (3)
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
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(2,16): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(3,16): error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(4,16): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(8,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(9,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(12,17): error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(13,17): error TS2558: Expected 0 type arguments, but got 1.
tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts(14,17): error TS2558: Expected 0 type arguments, but got 1.


==== tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts (8 errors) ====
    function foo<T, U>(x:T, y:U, f: (v: T) => U) {
        var r1 = f<number>(1);
                   ~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r2 = f(1);
                   ~
!!! error TS2345: Argument of type 'number' is not assignable to parameter of type 'T'.
!!! error TS2345:   'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
        var r3 = f<any>(null);
                   ~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r4 = f(null);
    
        var r11 = f(x);
        var r21 = f<number>(x);
                    ~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r31 = f<any>(null);
                    ~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r41 = f(null);
    
        var r12 = f(y);
                    ~
!!! error TS2345: Argument of type 'U' is not assignable to parameter of type 'T'.
!!! error TS2345:   'T' could be instantiated with an arbitrary type which could be unrelated to 'U'.
!!! related TS2208 tests/cases/compiler/genericCallbackInvokedInsideItsContainingFunction1.ts:1:17: This type parameter might need an `extends T` constraint.
        var r22 = f<number>(y);
                    ~~~~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r32 = f<any>(null);
                    ~~~
!!! error TS2558: Expected 0 type arguments, but got 1.
        var r42 = f(null);
    }