File: tsxAttributeResolution1.errors.txt

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (58 lines) | stat: -rw-r--r-- 2,284 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
tests/cases/conformance/jsx/file.tsx(23,8): error TS2322: Type '"0"' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(24,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
tests/cases/conformance/jsx/file.tsx(25,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
tests/cases/conformance/jsx/file.tsx(26,8): error TS2322: Type '"32"' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(27,8): error TS2339: Property 'var' does not exist on type 'Attribs1'.
tests/cases/conformance/jsx/file.tsx(29,1): error TS2324: Property 'reqd' is missing in type '{ reqd: string; }'.
tests/cases/conformance/jsx/file.tsx(30,8): error TS2322: Type '10' is not assignable to type 'string'.


==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
    declare module JSX {
    	interface Element { }
    	interface IntrinsicElements {
    		test1: Attribs1;
    		test2: { reqd: string };
    		var: { var: string };
    	}
    }
    interface Attribs1 {
    	x?: number;
    	s?: string;
    }
    
    // OK
    <test1 x={0} />; // OK
    <test1 />; // OK
    <test1 data-x={true} />; // OK
    
    <test2 reqd='true' />; // OK
    <test2 reqd={'true'} />; // OK
    
    // Errors
    <test1 x={'0'} />; // Error, '0' is not number
           ~~~~~~~
!!! error TS2322: Type '"0"' is not assignable to type 'number'.
    <test1 y={0} />; // Error, no property "y"
           ~
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
    <test1 y="foo" />; // Error, no property "y"
           ~
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
    <test1 x="32" />; // Error, "32" is not number
           ~~~~~~
!!! error TS2322: Type '"32"' is not assignable to type 'number'.
    <test1 var="10" />; // Error, no 'var' property
           ~~~
!!! error TS2339: Property 'var' does not exist on type 'Attribs1'.
    
    <test2 />; // Error, missing reqd
    ~~~~~~~~~
!!! error TS2324: Property 'reqd' is missing in type '{ reqd: string; }'.
    <test2 reqd={10} />; // Error, reqd is not string
           ~~~~~~~~~
!!! error TS2322: Type '10' is not assignable to type 'string'.
    
    // Should be OK
    <var var='var' />;