File: genericCallWithTupleType.errors.txt

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (62 lines) | stat: -rw-r--r-- 3,750 bytes parent folder | download
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
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(12,1): error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]'.
  Types of property 'length' are incompatible.
    Type '4' is not assignable to type '2'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(13,20): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,1): error TS2322: Type '{ a: string; }' is not assignable to type 'undefined'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(14,11): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '3'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(15,20): error TS2493: Tuple type '[string, number]' of length '2' has no element at index '3'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,14): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(22,17): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,14): error TS2322: Type '{}' is not assignable to type 'string'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(23,18): error TS2322: Type '{}' is not assignable to type 'number'.
tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts(24,1): error TS2741: Property '1' is missing in type '[{}]' but required in type '[{}, {}]'.


==== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithTupleType.ts (10 errors) ====
    interface I<T, U> {
        tuple1: [T, U];
    } 
    
    var i1: I<string, number>;
    var i2: I<{}, {}>;
    
    // no error
    i1.tuple1 = ["foo", 5];
    var e1 = i1.tuple1[0];  // string
    var e2 = i1.tuple1[1];  // number
    i1.tuple1 = ["foo", 5, false, true];
    ~~~~~~~~~
!!! error TS2322: Type '[string, number, boolean, boolean]' is not assignable to type '[string, number]'.
!!! error TS2322:   Types of property 'length' are incompatible.
!!! error TS2322:     Type '4' is not assignable to type '2'.
    var e3 = i1.tuple1[2];  // {}
                       ~
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '2'.
    i1.tuple1[3] = { a: "string" };
    ~~~~~~~~~~~~
!!! error TS2322: Type '{ a: string; }' is not assignable to type 'undefined'.
              ~
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '3'.
    var e4 = i1.tuple1[3];  // {}
                       ~
!!! error TS2493: Tuple type '[string, number]' of length '2' has no element at index '3'.
    i2.tuple1 = ["foo", 5];
    i2.tuple1 = ["foo", "bar"];
    i2.tuple1 = [5, "bar"];
    i2.tuple1 = [{}, {}];
    
    // error
    i1.tuple1 = [5, "foo"];
                 ~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
                    ~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
    i1.tuple1 = [{}, {}];
                 ~~
!!! error TS2322: Type '{}' is not assignable to type 'string'.
                     ~~
!!! error TS2322: Type '{}' is not assignable to type 'number'.
    i2.tuple1 = [{}];
    ~~~~~~~~~
!!! error TS2741: Property '1' is missing in type '[{}]' but required in type '[{}, {}]'.