File: stringLiteralTypesOverloadAssignability01.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports
  • size: 203,960 kB
  • sloc: sh: 11; makefile: 5
file content (33 lines) | stat: -rw-r--r-- 1,471 bytes parent folder | download | duplicates (2)
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
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(15,1): error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
  Types of parameters 'x' and 'x' are incompatible.
    Type '"foo"' is not assignable to type '"bar"'.
tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts(16,1): error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
  Types of parameters 'x' and 'x' are incompatible.
    Type '"bar"' is not assignable to type '"foo"'.


==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesOverloadAssignability01.ts (2 errors) ====
    
    function f(x: "foo"): number;
    function f(x: string): number {
        return 0;
    }
    
    function g(x: "bar"): number;
    function g(x: string): number {
        return 0;
    }
    
    let a = f;
    let b = g;
    
    a = b;
    ~
!!! error TS2322: Type '(x: "bar") => number' is not assignable to type '(x: "foo") => number'.
!!! error TS2322:   Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322:     Type '"foo"' is not assignable to type '"bar"'.
    b = a;
    ~
!!! error TS2322: Type '(x: "foo") => number' is not assignable to type '(x: "bar") => number'.
!!! error TS2322:   Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322:     Type '"bar"' is not assignable to type '"foo"'.