File: everyTypeWithAnnotationAndInvalidInitializer.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 (136 lines) | stat: -rw-r--r-- 7,650 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
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(34,5): error TS2322: Type '"this is a string"' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(35,5): error TS2322: Type '9.9' is not assignable to type 'string'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(36,5): error TS2322: Type '9.9' is not assignable to type 'Date'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(38,5): error TS2322: Type '9.9' is not assignable to type 'void'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(40,5): error TS2322: Type 'D<{}>' is not assignable to type 'I'.
  Property 'id' is missing in type 'D<{}>'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(41,5): error TS2322: Type 'D<{}>' is not assignable to type 'C'.
  Property 'id' is missing in type 'D<{}>'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(42,5): error TS2322: Type 'C' is not assignable to type 'D<string>'.
  Property 'source' is missing in type 'C'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(43,5): error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
  Types of property 'id' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(44,5): error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
  Types of property 'id' are incompatible.
    Type 'number' is not assignable to type 'string'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(46,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
  Types of parameters 'x' and 'x' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(47,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
  Types of parameters 'x' and 'x' are incompatible.
    Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(48,5): error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
  Type 'string' is not assignable to type 'number'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(50,5): error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
  Types of property 'A' are incompatible.
    Type 'typeof N.A' is not assignable to type 'typeof M.A'.
      Type 'N.A' is not assignable to type 'M.A'.
        Property 'name' is missing in type 'A'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(51,5): error TS2322: Type 'N.A' is not assignable to type 'M.A'.
tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts(52,5): error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
  Type 'boolean' is not assignable to type 'string'.


==== tests/cases/conformance/statements/VariableStatements/everyTypeWithAnnotationAndInvalidInitializer.ts (15 errors) ====
    interface I {
        id: number;
    }
    
    class C implements I {
        id: number;
    }
    
    class D<T>{
        source: T;
        recurse: D<T>;
        wrapped: D<D<T>>
    }
    
    function F(x: string): number { return 42; }
    function F2(x: number): boolean { return x < 42; }
    
    module M {
        export class A {
            name: string;
        }
    
        export function F2(x: number): string { return x.toString(); }
    }
    
    module N {
        export class A {
            id: number;
        }
    
        export function F2(x: number): string { return x.toString(); }
    }
    
    var aNumber: number = 'this is a string';
        ~~~~~~~
!!! error TS2322: Type '"this is a string"' is not assignable to type 'number'.
    var aString: string = 9.9;
        ~~~~~~~
!!! error TS2322: Type '9.9' is not assignable to type 'string'.
    var aDate: Date = 9.9;
        ~~~~~
!!! error TS2322: Type '9.9' is not assignable to type 'Date'.
    
    var aVoid: void = 9.9;
        ~~~~~
!!! error TS2322: Type '9.9' is not assignable to type 'void'.
    
    var anInterface: I = new D();
        ~~~~~~~~~~~
!!! error TS2322: Type 'D<{}>' is not assignable to type 'I'.
!!! error TS2322:   Property 'id' is missing in type 'D<{}>'.
    var aClass: C = new D();
        ~~~~~~
!!! error TS2322: Type 'D<{}>' is not assignable to type 'C'.
!!! error TS2322:   Property 'id' is missing in type 'D<{}>'.
    var aGenericClass: D<string> = new C();
        ~~~~~~~~~~~~~
!!! error TS2322: Type 'C' is not assignable to type 'D<string>'.
!!! error TS2322:   Property 'source' is missing in type 'C'.
    var anObjectLiteral: I = { id: 'a string' };
        ~~~~~~~~~~~~~~~
!!! error TS2322: Type '{ id: string; }' is not assignable to type 'I'.
!!! error TS2322:   Types of property 'id' are incompatible.
!!! error TS2322:     Type 'string' is not assignable to type 'number'.
    var anOtherObjectLiteral: { id: string } = new C();
        ~~~~~~~~~~~~~~~~~~~~
!!! error TS2322: Type 'C' is not assignable to type '{ id: string; }'.
!!! error TS2322:   Types of property 'id' are incompatible.
!!! error TS2322:     Type 'number' is not assignable to type 'string'.
    
    var aFunction: typeof F = F2;
        ~~~~~~~~~
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
!!! error TS2322:   Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322:     Type 'string' is not assignable to type 'number'.
    var anOtherFunction: (x: string) => number = F2;
        ~~~~~~~~~~~~~~~
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: string) => number'.
!!! error TS2322:   Types of parameters 'x' and 'x' are incompatible.
!!! error TS2322:     Type 'string' is not assignable to type 'number'.
    var aLambda: typeof F = (x) => 'a string';
        ~~~~~~~
!!! error TS2322: Type '(x: string) => string' is not assignable to type '(x: string) => number'.
!!! error TS2322:   Type 'string' is not assignable to type 'number'.
    
    var aModule: typeof M = N;
        ~~~~~~~
!!! error TS2322: Type 'typeof N' is not assignable to type 'typeof M'.
!!! error TS2322:   Types of property 'A' are incompatible.
!!! error TS2322:     Type 'typeof N.A' is not assignable to type 'typeof M.A'.
!!! error TS2322:       Type 'N.A' is not assignable to type 'M.A'.
!!! error TS2322:         Property 'name' is missing in type 'A'.
    var aClassInModule: M.A = new N.A();
        ~~~~~~~~~~~~~~
!!! error TS2322: Type 'N.A' is not assignable to type 'M.A'.
    var aFunctionInModule: typeof M.F2 = F2;
        ~~~~~~~~~~~~~~~~~
!!! error TS2322: Type '(x: number) => boolean' is not assignable to type '(x: number) => string'.
!!! error TS2322:   Type 'boolean' is not assignable to type 'string'.