File: tsxElementResolution9.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 (78 lines) | stat: -rw-r--r-- 4,403 bytes parent folder | download | duplicates (4)
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
tests/cases/conformance/jsx/file.tsx(11,2): error TS2769: No overload matches this call.
  Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
    Type '{}' is not assignable to type 'string'.
  Overload 2 of 2, '(n: number): { y: string; }', gave the following error.
    Type '{}' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(18,2): error TS2769: No overload matches this call.
  Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
    Type '{}' is not assignable to type 'string'.
  Overload 2 of 2, '(n: number): { y: string; }', gave the following error.
    Type '{}' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(18,2): error TS2786: 'Obj2' cannot be used as a JSX component.
  Its return type '{ x: number; } & { y: string; }' is not a valid JSX element.
    Property 'something' is missing in type '{ x: number; } & { y: string; }' but required in type 'Element'.
tests/cases/conformance/jsx/file.tsx(25,2): error TS2769: No overload matches this call.
  Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
    Type '{ x: number; }' is not assignable to type 'string'.
  Overload 2 of 2, '(n: number): { x: number; y: string; }', gave the following error.
    Type '{ x: number; }' is not assignable to type 'number'.
tests/cases/conformance/jsx/file.tsx(25,2): error TS2786: 'Obj3' cannot be used as a JSX component.
  Its return type '{ x: number; } & { x: number; y: string; }' is not a valid JSX element.
    Property 'something' is missing in type '{ x: number; } & { x: number; y: string; }' but required in type 'Element'.


==== tests/cases/conformance/jsx/file.tsx (5 errors) ====
    declare module JSX {
    	interface Element { something; }
    	interface IntrinsicElements { }
    }
    
    interface Obj1 {
    	new(n: string): { x: number };
    	new(n: number): { y: string };
    }
    var Obj1: Obj1;
    <Obj1 />; // Error, return type is not an object type
     ~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
!!! error TS2769:     Type '{}' is not assignable to type 'string'.
!!! error TS2769:   Overload 2 of 2, '(n: number): { y: string; }', gave the following error.
!!! error TS2769:     Type '{}' is not assignable to type 'number'.
    
    interface Obj2 {
    	(n: string): { x: number };
    	(n: number): { y: string };
    }
    var Obj2: Obj2;
    <Obj2 />; // Error, return type is not an object type
     ~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
!!! error TS2769:     Type '{}' is not assignable to type 'string'.
!!! error TS2769:   Overload 2 of 2, '(n: number): { y: string; }', gave the following error.
!!! error TS2769:     Type '{}' is not assignable to type 'number'.
     ~~~~
!!! error TS2786: 'Obj2' cannot be used as a JSX component.
!!! error TS2786:   Its return type '{ x: number; } & { y: string; }' is not a valid JSX element.
!!! error TS2786:     Property 'something' is missing in type '{ x: number; } & { y: string; }' but required in type 'Element'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:2:22: 'something' is declared here.
    
    interface Obj3 {
    	(n: string): { x: number };
    	(n: number): { x: number; y: string };
    }
    var Obj3: Obj3;
    <Obj3 x={42} />; // OK
     ~~~~
!!! error TS2769: No overload matches this call.
!!! error TS2769:   Overload 1 of 2, '(n: string): { x: number; }', gave the following error.
!!! error TS2769:     Type '{ x: number; }' is not assignable to type 'string'.
!!! error TS2769:   Overload 2 of 2, '(n: number): { x: number; y: string; }', gave the following error.
!!! error TS2769:     Type '{ x: number; }' is not assignable to type 'number'.
     ~~~~
!!! error TS2786: 'Obj3' cannot be used as a JSX component.
!!! error TS2786:   Its return type '{ x: number; } & { x: number; y: string; }' is not a valid JSX element.
!!! error TS2786:     Property 'something' is missing in type '{ x: number; } & { x: number; y: string; }' but required in type 'Element'.
!!! related TS2728 tests/cases/conformance/jsx/file.tsx:2:22: 'something' is declared here.