Skip to content

Commit 30a8f17

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

5 files changed

+283
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
tests/cases/conformance/jsx/inline/jsx-globals.d.ts(1,9): error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.
2+
3+
4+
==== tests/cases/conformance/jsx/inline/jsx-globals.d.ts (1 errors) ====
5+
declare global {
6+
~~~~~~
7+
!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.
8+
namespace JSX {
9+
interface IntrinsicElements {
10+
[e: string]: any;
11+
}
12+
}
13+
}
14+
15+
==== tests/cases/conformance/jsx/inline/react.d.ts (0 errors) ====
16+
export function createElement(): void;
17+
export function Fragment(): void;
18+
19+
==== tests/cases/conformance/jsx/inline/preact.d.ts (0 errors) ====
20+
export function h(): void;
21+
22+
==== tests/cases/conformance/jsx/inline/snabbdom.d.ts (0 errors) ====
23+
export function h(): void;
24+
export function Frag(): void;
25+
26+
==== tests/cases/conformance/jsx/inline/reacty.tsx (0 errors) ====
27+
import {createElement, Fragment} from "./react";
28+
<><span></span></>
29+
30+
==== tests/cases/conformance/jsx/inline/snabbdomy.tsx (0 errors) ====
31+
/**
32+
* @jsx h
33+
* @jsxFrag Frag
34+
*/
35+
import {h, Frag} from "./snabbdom";
36+
<><div></div></>
37+
38+
==== tests/cases/conformance/jsx/inline/mix-n-match.tsx (0 errors) ====
39+
/* @jsx h */
40+
/* @jsxFrag Frag */
41+
import {h} from "./preact";
42+
import {Frag} from "./snabbdom";
43+
<><span></span></>
Lines changed: 65 additions & 0 deletions
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+
//// [react.d.ts]
13+
export function createElement(): void;
14+
export function Fragment(): void;
15+
16+
//// [preact.d.ts]
17+
export function h(): void;
18+
19+
//// [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));
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
=== tests/cases/conformance/jsx/inline/react.d.ts ===
18+
export function createElement(): void;
19+
>createElement : Symbol(createElement, Decl(react.d.ts, 0, 0))
20+
21+
export function Fragment(): void;
22+
>Fragment : Symbol(Fragment, Decl(react.d.ts, 0, 38))
23+
24+
=== tests/cases/conformance/jsx/inline/preact.d.ts ===
25+
export function h(): void;
26+
>h : Symbol(h, Decl(preact.d.ts, 0, 0))
27+
28+
=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
29+
export function h(): void;
30+
>h : Symbol(h, Decl(snabbdom.d.ts, 0, 0))
31+
32+
export function Frag(): void;
33+
>Frag : Symbol(Frag, Decl(snabbdom.d.ts, 0, 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+
42+
=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
43+
/**
44+
* @jsx h
45+
* @jsxFrag Frag
46+
*/
47+
import {h, Frag} from "./snabbdom";
48+
>h : Symbol(h, Decl(snabbdomy.tsx, 4, 8))
49+
>Frag : Symbol(Frag, Decl(snabbdomy.tsx, 4, 10))
50+
51+
<><div></div></>
52+
53+
=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
54+
/* @jsx h */
55+
/* @jsxFrag Frag */
56+
import {h} from "./preact";
57+
>h : Symbol(h, Decl(mix-n-match.tsx, 2, 8))
58+
59+
import {Frag} from "./snabbdom";
60+
>Frag : Symbol(Frag, Decl(mix-n-match.tsx, 3, 8))
61+
62+
<><span></span></>
Lines changed: 71 additions & 0 deletions
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 : typeof global
4+
5+
namespace JSX {
6+
interface IntrinsicElements {
7+
[e: string]: any;
8+
>e : string
9+
}
10+
}
11+
}
12+
13+
=== tests/cases/conformance/jsx/inline/react.d.ts ===
14+
export function createElement(): void;
15+
>createElement : () => void
16+
17+
export function Fragment(): void;
18+
>Fragment : () => void
19+
20+
=== tests/cases/conformance/jsx/inline/preact.d.ts ===
21+
export function h(): void;
22+
>h : () => void
23+
24+
=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
25+
export function h(): void;
26+
>h : () => 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 : () => void
34+
>Fragment : () => void
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 : () => void
49+
>Frag : () => void
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 : () => void
62+
63+
import {Frag} from "./snabbdom";
64+
>Frag : () => void
65+
66+
<><span></span></>
67+
><><span></span></> : any
68+
><span></span> : any
69+
>span : any
70+
>span : any
71+
Lines changed: 42 additions & 0 deletions
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)