File: tsxStatelessFunctionComponentOverload3.js

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (37 lines) | stat: -rw-r--r-- 1,702 bytes parent folder | download | duplicates (5)
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
//// [file.tsx]
interface Context {
    color: any;
}
declare function ZeroThingOrTwoThing(): JSX.Element;
declare function ZeroThingOrTwoThing(l: {yy: number, yy1: string}, context: Context): JSX.Element;

let obj2: any;

// OK
const two1 = <ZeroThingOrTwoThing />;
const two2 = <ZeroThingOrTwoThing yy={100}  yy1="hello"/>;
const two3 = <ZeroThingOrTwoThing {...obj2} />;  // it is just any so we allow it to pass through
const two4 = <ZeroThingOrTwoThing  yy={1000} {...obj2} />;  // it is just any so we allow it to pass through
const two5 = <ZeroThingOrTwoThing  {...obj2} yy={1000} />;  // it is just any so we allow it to pass through

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

// OK
const three1 = <ThreeThing yy={99} yy1="hello world" />;
const three2 = <ThreeThing y2="Bye" />;
const three3 = <ThreeThing {...obj2} y2={10} />;  // it is just any so we allow it to pass through

//// [file.jsx]
var obj2;
// OK
var two1 = <ZeroThingOrTwoThing />;
var two2 = <ZeroThingOrTwoThing yy={100} yy1="hello"/>;
var two3 = <ZeroThingOrTwoThing {...obj2}/>; // it is just any so we allow it to pass through
var two4 = <ZeroThingOrTwoThing yy={1000} {...obj2}/>; // it is just any so we allow it to pass through
var two5 = <ZeroThingOrTwoThing {...obj2} yy={1000}/>; // it is just any so we allow it to pass through
// OK
var three1 = <ThreeThing yy={99} yy1="hello world"/>;
var three2 = <ThreeThing y2="Bye"/>;
var three3 = <ThreeThing {...obj2} y2={10}/>; // it is just any so we allow it to pass through