File: invalidNumberAssignments.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (58 lines) | stat: -rw-r--r-- 2,996 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
49
50
51
52
53
54
55
56
57
58
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(3,5): error TS2322: Type 'number' is not assignable to type 'boolean'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(4,5): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(5,5): error TS2322: Type 'number' is not assignable to type 'void'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(9,5): error TS2322: Type 'number' is not assignable to type 'C'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(12,5): error TS2322: Type 'number' is not assignable to type 'I'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(14,5): error TS2322: Type 'number' is not assignable to type '{ baz: string; }'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(15,5): error TS2322: Type 'number' is not assignable to type '{ 0: number; }'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(18,1): error TS2631: Cannot assign to 'M' because it is a namespace.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(21,5): error TS2322: Type 'number' is not assignable to type 'T'.
  'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts(23,1): error TS2630: Cannot assign to 'i' because it is a function.


==== tests/cases/conformance/types/primitives/number/invalidNumberAssignments.ts (10 errors) ====
    var x = 1;
    
    var a: boolean = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'boolean'.
    var b: string = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
    var c: void = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'void'.
    var d: typeof undefined = x;
    
    class C { foo: string; }
    var e: C = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'C'.
    
    interface I { bar: string; }
    var f: I = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'I'.
    
    var g: { baz: string } = 1;
        ~
!!! error TS2322: Type 'number' is not assignable to type '{ baz: string; }'.
    var g2: { 0: number } = 1;
        ~~
!!! error TS2322: Type 'number' is not assignable to type '{ 0: number; }'.
    
    module M { export var x = 1; }
    M = x;
    ~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
    
    function i<T>(a: T) {
        a = x;
        ~
!!! error TS2322: Type 'number' is not assignable to type 'T'.
!!! error TS2322:   'T' could be instantiated with an arbitrary type which could be unrelated to 'number'.
    }
    i = x;
    ~
!!! error TS2630: Cannot assign to 'i' because it is a function.