Skip to content

Commit 9927484

Browse files
committed
jsxFrag elision test (TODO: figure out with weswigham)
1 parent fe8099a commit 9927484

5 files changed

+299
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
tests/cases/conformance/jsx/inline/mix-n-match.tsx(3,17): error TS2307: Cannot find module './preact' or its corresponding type declarations.
2+
tests/cases/conformance/jsx/inline/mix-n-match.tsx(4,20): error TS2307: Cannot find module './snabbdom' or its corresponding type declarations.
3+
tests/cases/conformance/jsx/inline/reacty.tsx(1,39): error TS2307: Cannot find module './react' or its corresponding type declarations.
4+
tests/cases/conformance/jsx/inline/snabbdomy.tsx(5,23): error TS2307: Cannot find module './snabbdom' or its corresponding type declarations.
5+
6+
7+
==== tests/cases/conformance/jsx/inline/jsx-globals.d.ts (0 errors) ====
8+
declare global {
9+
namespace JSX {
10+
interface IntrinsicElements {
11+
[e: string]: any;
12+
}
13+
}
14+
}
15+
16+
// @filename react.d.ts
17+
export function createElement(): void;
18+
export function Fragment(): void;
19+
20+
// @filename preact.d.ts
21+
export function h(): void;
22+
23+
// @filename snabbdom.d.ts
24+
export function h(): void;
25+
export function Frag(): void;
26+
27+
==== tests/cases/conformance/jsx/inline/reacty.tsx (1 errors) ====
28+
import {createElement, Fragment} from "./react";
29+
~~~~~~~~~
30+
!!! error TS2307: Cannot find module './react' or its corresponding type declarations.
31+
<><span></span></>
32+
33+
==== tests/cases/conformance/jsx/inline/snabbdomy.tsx (1 errors) ====
34+
/**
35+
* @jsx h
36+
* @jsxFrag Frag
37+
*/
38+
import {h, Frag} from "./snabbdom";
39+
~~~~~~~~~~~~
40+
!!! error TS2307: Cannot find module './snabbdom' or its corresponding type declarations.
41+
<><div></div></>
42+
43+
==== tests/cases/conformance/jsx/inline/mix-n-match.tsx (2 errors) ====
44+
/* @jsx h */
45+
/* @jsxFrag Frag */
46+
import {h} from "./preact";
47+
~~~~~~~~~~
48+
!!! error TS2307: Cannot find module './preact' or its corresponding type declarations.
49+
import {Frag} from "./snabbdom";
50+
~~~~~~~~~~~~
51+
!!! error TS2307: Cannot find module './snabbdom' or its corresponding type declarations.
52+
<><span></span></>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
//// [tests/cases/conformance/jsx/inline/inlineJsxAndJsxFragPragmaOverridesCompilerOptions.tsx] ////
2+
3+
//// [jsx-globals.d.ts]
4+
declare global {
5+
namespace JSX {
6+
interface IntrinsicElements {
7+
[e: string]: any;
8+
}
9+
}
10+
}
11+
12+
// @filename react.d.ts
13+
export function createElement(): void;
14+
export function Fragment(): void;
15+
16+
// @filename preact.d.ts
17+
export function h(): void;
18+
19+
// @filename snabbdom.d.ts
20+
export function h(): void;
21+
export function Frag(): void;
22+
23+
//// [reacty.tsx]
24+
import {createElement, Fragment} from "./react";
25+
<><span></span></>
26+
27+
//// [snabbdomy.tsx]
28+
/**
29+
* @jsx h
30+
* @jsxFrag Frag
31+
*/
32+
import {h, Frag} from "./snabbdom";
33+
<><div></div></>
34+
35+
//// [mix-n-match.tsx]
36+
/* @jsx h */
37+
/* @jsxFrag Frag */
38+
import {h} from "./preact";
39+
import {Frag} from "./snabbdom";
40+
<><span></span></>
41+
42+
//// [reacty.js]
43+
"use strict";
44+
exports.__esModule = true;
45+
var react_1 = require("./react");
46+
react_1.createElement(react_1.Fragment, null,
47+
react_1.createElement("span", null));
48+
//// [snabbdomy.js]
49+
"use strict";
50+
exports.__esModule = true;
51+
/**
52+
* @jsx h
53+
* @jsxFrag Frag
54+
*/
55+
var snabbdom_1 = require("./snabbdom");
56+
snabbdom_1.h(snabbdom_1.Frag, null,
57+
snabbdom_1.h("div", null));
58+
//// [mix-n-match.js]
59+
"use strict";
60+
exports.__esModule = true;
61+
/* @jsx h */
62+
/* @jsxFrag Frag */
63+
var preact_1 = require("./preact");
64+
preact_1.h(snabbdom_1.Frag, null,
65+
preact_1.h("span", null));
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
=== tests/cases/conformance/jsx/inline/jsx-globals.d.ts ===
2+
declare global {
3+
>global : Symbol(global, Decl(jsx-globals.d.ts, 0, 0))
4+
5+
namespace JSX {
6+
>JSX : Symbol(JSX, Decl(jsx-globals.d.ts, 0, 16))
7+
8+
interface IntrinsicElements {
9+
>IntrinsicElements : Symbol(IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
10+
11+
[e: string]: any;
12+
>e : Symbol(e, Decl(jsx-globals.d.ts, 3, 13))
13+
}
14+
}
15+
}
16+
17+
// @filename react.d.ts
18+
export function createElement(): void;
19+
>createElement : Symbol(createElement, Decl(jsx-globals.d.ts, 6, 1))
20+
21+
export function Fragment(): void;
22+
>Fragment : Symbol(Fragment, Decl(jsx-globals.d.ts, 9, 38))
23+
24+
// @filename preact.d.ts
25+
export function h(): void;
26+
>h : Symbol(h, Decl(jsx-globals.d.ts, 10, 33), Decl(jsx-globals.d.ts, 13, 26))
27+
28+
// @filename snabbdom.d.ts
29+
export function h(): void;
30+
>h : Symbol(h, Decl(jsx-globals.d.ts, 10, 33), Decl(jsx-globals.d.ts, 13, 26))
31+
32+
export function Frag(): void;
33+
>Frag : Symbol(Frag, Decl(jsx-globals.d.ts, 16, 26))
34+
35+
=== tests/cases/conformance/jsx/inline/reacty.tsx ===
36+
import {createElement, Fragment} from "./react";
37+
>createElement : Symbol(createElement, Decl(reacty.tsx, 0, 8))
38+
>Fragment : Symbol(Fragment, Decl(reacty.tsx, 0, 22))
39+
40+
<><span></span></>
41+
>span : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
42+
>span : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
43+
44+
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
45+
/**
46+
* @jsx h
47+
* @jsxFrag Frag
48+
*/
49+
import {h, Frag} from "./snabbdom";
50+
>h : Symbol(h, Decl(snabbdomy.tsx, 4, 8))
51+
>Frag : Symbol(Frag, Decl(snabbdomy.tsx, 4, 10))
52+
53+
<><div></div></>
54+
>div : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
55+
>div : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
56+
57+
=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
58+
/* @jsx h */
59+
/* @jsxFrag Frag */
60+
import {h} from "./preact";
61+
>h : Symbol(h, Decl(mix-n-match.tsx, 2, 8))
62+
63+
import {Frag} from "./snabbdom";
64+
>Frag : Symbol(Frag, Decl(mix-n-match.tsx, 3, 8))
65+
66+
<><span></span></>
67+
>span : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
68+
>span : Symbol(JSX.IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))
69+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
=== tests/cases/conformance/jsx/inline/jsx-globals.d.ts ===
2+
declare global {
3+
>global : any
4+
5+
namespace JSX {
6+
interface IntrinsicElements {
7+
[e: string]: any;
8+
>e : string
9+
}
10+
}
11+
}
12+
13+
// @filename react.d.ts
14+
export function createElement(): void;
15+
>createElement : () => void
16+
17+
export function Fragment(): void;
18+
>Fragment : () => void
19+
20+
// @filename preact.d.ts
21+
export function h(): void;
22+
>h : { (): void; (): void; }
23+
24+
// @filename snabbdom.d.ts
25+
export function h(): void;
26+
>h : { (): void; (): void; }
27+
28+
export function Frag(): void;
29+
>Frag : () => void
30+
31+
=== tests/cases/conformance/jsx/inline/reacty.tsx ===
32+
import {createElement, Fragment} from "./react";
33+
>createElement : any
34+
>Fragment : any
35+
36+
<><span></span></>
37+
><><span></span></> : any
38+
><span></span> : any
39+
>span : any
40+
>span : any
41+
42+
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
43+
/**
44+
* @jsx h
45+
* @jsxFrag Frag
46+
*/
47+
import {h, Frag} from "./snabbdom";
48+
>h : any
49+
>Frag : any
50+
51+
<><div></div></>
52+
><><div></div></> : any
53+
><div></div> : any
54+
>div : any
55+
>div : any
56+
57+
=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
58+
/* @jsx h */
59+
/* @jsxFrag Frag */
60+
import {h} from "./preact";
61+
>h : any
62+
63+
import {Frag} from "./snabbdom";
64+
>Frag : any
65+
66+
<><span></span></>
67+
><><span></span></> : any
68+
><span></span> : any
69+
>span : any
70+
>span : any
71+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// @jsx: react
2+
// @jsxFactory: createElement
3+
// @jsxFragmentFactory: Fragment
4+
5+
// @filename: jsx-globals.d.ts
6+
declare global {
7+
namespace JSX {
8+
interface IntrinsicElements {
9+
[e: string]: any;
10+
}
11+
}
12+
}
13+
14+
// @filename react.d.ts
15+
export function createElement(): void;
16+
export function Fragment(): void;
17+
18+
// @filename preact.d.ts
19+
export function h(): void;
20+
21+
// @filename snabbdom.d.ts
22+
export function h(): void;
23+
export function Frag(): void;
24+
25+
// @filename: reacty.tsx
26+
import {createElement, Fragment} from "./react";
27+
<><span></span></>
28+
29+
// @filename: snabbdomy.tsx
30+
/**
31+
* @jsx h
32+
* @jsxFrag Frag
33+
*/
34+
import {h, Frag} from "./snabbdom";
35+
<><div></div></>
36+
37+
// @filename: mix-n-match.tsx
38+
/* @jsx h */
39+
/* @jsxFrag Frag */
40+
import {h} from "./preact";
41+
import {Frag} from "./snabbdom";
42+
<><span></span></>

0 commit comments

Comments
 (0)