File: tsxStatelessFunctionComponentOverload3.types

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (100 lines) | stat: -rw-r--r-- 4,108 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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
=== tests/cases/conformance/jsx/file.tsx ===
interface Context {
    color: any;
>color : any
}
declare function ZeroThingOrTwoThing(): JSX.Element;
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }
>JSX : any

declare function ZeroThingOrTwoThing(l: {yy: number, yy1: string}, context: Context): JSX.Element;
>ZeroThingOrTwoThing : { (): JSX.Element; (l: {    yy: number;    yy1: string;}, context: Context): JSX.Element; }
>l : { yy: number; yy1: string; }
>yy : number
>yy1 : string
>context : Context
>JSX : any

let obj2: any;
>obj2 : any

// OK
const two1 = <ZeroThingOrTwoThing />;
>two1 : JSX.Element
><ZeroThingOrTwoThing /> : JSX.Element
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }

const two2 = <ZeroThingOrTwoThing yy={100}  yy1="hello"/>;
>two2 : JSX.Element
><ZeroThingOrTwoThing yy={100}  yy1="hello"/> : JSX.Element
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }
>yy : number
>100 : 100
>yy1 : string

const two3 = <ZeroThingOrTwoThing {...obj2} />;  // it is just any so we allow it to pass through
>two3 : JSX.Element
><ZeroThingOrTwoThing {...obj2} /> : JSX.Element
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }
>obj2 : any

const two4 = <ZeroThingOrTwoThing  yy={1000} {...obj2} />;  // it is just any so we allow it to pass through
>two4 : JSX.Element
><ZeroThingOrTwoThing  yy={1000} {...obj2} /> : JSX.Element
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }
>yy : number
>1000 : 1000
>obj2 : any

const two5 = <ZeroThingOrTwoThing  {...obj2} yy={1000} />;  // it is just any so we allow it to pass through
>two5 : JSX.Element
><ZeroThingOrTwoThing  {...obj2} yy={1000} /> : JSX.Element
>ZeroThingOrTwoThing : { (): JSX.Element; (l: { yy: number; yy1: string; }, context: Context): JSX.Element; }
>obj2 : any
>yy : number
>1000 : 1000

declare function ThreeThing(l: {y1: string}): JSX.Element;
>ThreeThing : { (l: {    y1: string;}): JSX.Element; (l: { y2: string; }): JSX.Element; (l: { yy: number; yy1: string; }, context: Context, updater: any): JSX.Element; }
>l : { y1: string; }
>y1 : string
>JSX : any

declare function ThreeThing(l: {y2: string}): JSX.Element;
>ThreeThing : { (l: { y1: string; }): JSX.Element; (l: {    y2: string;}): JSX.Element; (l: { yy: number; yy1: string; }, context: Context, updater: any): JSX.Element; }
>l : { y2: string; }
>y2 : string
>JSX : any

declare function ThreeThing(l: {yy: number, yy1: string}, context: Context, updater: any): JSX.Element;
>ThreeThing : { (l: { y1: string; }): JSX.Element; (l: { y2: string; }): JSX.Element; (l: {    yy: number;    yy1: string;}, context: Context, updater: any): JSX.Element; }
>l : { yy: number; yy1: string; }
>yy : number
>yy1 : string
>context : Context
>updater : any
>JSX : any

// OK
const three1 = <ThreeThing yy={99} yy1="hello world" />;
>three1 : JSX.Element
><ThreeThing yy={99} yy1="hello world" /> : JSX.Element
>ThreeThing : { (l: { y1: string; }): JSX.Element; (l: { y2: string; }): JSX.Element; (l: { yy: number; yy1: string; }, context: Context, updater: any): JSX.Element; }
>yy : number
>99 : 99
>yy1 : string

const three2 = <ThreeThing y2="Bye" />;
>three2 : JSX.Element
><ThreeThing y2="Bye" /> : JSX.Element
>ThreeThing : { (l: { y1: string; }): JSX.Element; (l: { y2: string; }): JSX.Element; (l: { yy: number; yy1: string; }, context: Context, updater: any): JSX.Element; }
>y2 : string

const three3 = <ThreeThing {...obj2} y2={10} />;  // it is just any so we allow it to pass through
>three3 : JSX.Element
><ThreeThing {...obj2} y2={10} /> : JSX.Element
>ThreeThing : { (l: { y1: string; }): JSX.Element; (l: { y2: string; }): JSX.Element; (l: { yy: number; yy1: string; }, context: Context, updater: any): JSX.Element; }
>obj2 : any
>y2 : number
>10 : 10