File: bestCommonTypeOfTuple.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (40 lines) | stat: -rw-r--r-- 1,956 bytes parent folder | download | duplicates (5)
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
tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts(22,13): error TS2493: Tuple type '[(x: number) => string, (x: number) => number]' of length '2' has no element at index '2'.
tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts(23,13): error TS2493: Tuple type '[E1, E2]' of length '2' has no element at index '2'.
tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts(24,13): error TS2493: Tuple type '[number, any]' of length '2' has no element at index '2'.
tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts(25,13): error TS2493: Tuple type '[E1, E2, number]' of length '3' has no element at index '3'.


==== tests/cases/conformance/types/typeRelationships/bestCommonType/bestCommonTypeOfTuple.ts (4 errors) ====
    function f1(x: number): string { return "foo"; }
    
    function f2(x: number): number { return 10; }
    
    function f3(x: number): boolean { return true; }
    
    enum E1 { one }
    
    enum E2 { two }
    
    
    var t1: [(x: number) => string, (x: number) => number];
    var t2: [E1, E2];
    var t3: [number, any];
    var t4: [E1, E2, number];
    
    // no error
    t1 = [f1, f2];
    t2 = [E1.one, E2.two];
    t3 = [5, undefined];
    t4 = [E1.one, E2.two, 20];
    var e1 = t1[2];  // {}
                ~
!!! error TS2493: Tuple type '[(x: number) => string, (x: number) => number]' of length '2' has no element at index '2'.
    var e2 = t2[2];  // {}
                ~
!!! error TS2493: Tuple type '[E1, E2]' of length '2' has no element at index '2'.
    var e3 = t3[2];  // any
                ~
!!! error TS2493: Tuple type '[number, any]' of length '2' has no element at index '2'.
    var e4 = t4[3];  // number
                ~
!!! error TS2493: Tuple type '[E1, E2, number]' of length '3' has no element at index '3'.