Skip to content

Commit

Permalink
jsxFrag elision test (TODO: figure out with weswigham)
Browse files Browse the repository at this point in the history
  • Loading branch information
nojvek committed May 22, 2020
1 parent fe8099a commit 30a8f17
Show file tree
Hide file tree
Showing 5 changed files with 283 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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.


==== tests/cases/conformance/jsx/inline/jsx-globals.d.ts (1 errors) ====
declare global {
~~~~~~
!!! error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.
namespace JSX {
interface IntrinsicElements {
[e: string]: any;
}
}
}

==== tests/cases/conformance/jsx/inline/react.d.ts (0 errors) ====
export function createElement(): void;
export function Fragment(): void;

==== tests/cases/conformance/jsx/inline/preact.d.ts (0 errors) ====
export function h(): void;

==== tests/cases/conformance/jsx/inline/snabbdom.d.ts (0 errors) ====
export function h(): void;
export function Frag(): void;

==== tests/cases/conformance/jsx/inline/reacty.tsx (0 errors) ====
import {createElement, Fragment} from "./react";
<><span></span></>

==== tests/cases/conformance/jsx/inline/snabbdomy.tsx (0 errors) ====
/**
* @jsx h
* @jsxFrag Frag
*/
import {h, Frag} from "./snabbdom";
<><div></div></>

==== tests/cases/conformance/jsx/inline/mix-n-match.tsx (0 errors) ====
/* @jsx h */
/* @jsxFrag Frag */
import {h} from "./preact";
import {Frag} from "./snabbdom";
<><span></span></>
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
//// [tests/cases/conformance/jsx/inline/inlineJsxAndJsxFragPragmaOverridesCompilerOptions.tsx] ////

//// [jsx-globals.d.ts]
declare global {
namespace JSX {
interface IntrinsicElements {
[e: string]: any;
}
}
}

//// [react.d.ts]
export function createElement(): void;
export function Fragment(): void;

//// [preact.d.ts]
export function h(): void;

//// [snabbdom.d.ts]
export function h(): void;
export function Frag(): void;

//// [reacty.tsx]
import {createElement, Fragment} from "./react";
<><span></span></>

//// [snabbdomy.tsx]
/**
* @jsx h
* @jsxFrag Frag
*/
import {h, Frag} from "./snabbdom";
<><div></div></>

//// [mix-n-match.tsx]
/* @jsx h */
/* @jsxFrag Frag */
import {h} from "./preact";
import {Frag} from "./snabbdom";
<><span></span></>

//// [reacty.js]
"use strict";
exports.__esModule = true;
var react_1 = require("./react");
react_1.createElement(react_1.Fragment, null,
react_1.createElement("span", null));
//// [snabbdomy.js]
"use strict";
exports.__esModule = true;
/**
* @jsx h
* @jsxFrag Frag
*/
var snabbdom_1 = require("./snabbdom");
snabbdom_1.h(snabbdom_1.Frag, null,
snabbdom_1.h("div", null));
//// [mix-n-match.js]
"use strict";
exports.__esModule = true;
/* @jsx h */
/* @jsxFrag Frag */
var preact_1 = require("./preact");
preact_1.h(snabbdom_1.Frag, null,
preact_1.h("span", null));
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
=== tests/cases/conformance/jsx/inline/jsx-globals.d.ts ===
declare global {
>global : Symbol(global, Decl(jsx-globals.d.ts, 0, 0))

namespace JSX {
>JSX : Symbol(JSX, Decl(jsx-globals.d.ts, 0, 16))

interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(jsx-globals.d.ts, 1, 19))

[e: string]: any;
>e : Symbol(e, Decl(jsx-globals.d.ts, 3, 13))
}
}
}

=== tests/cases/conformance/jsx/inline/react.d.ts ===
export function createElement(): void;
>createElement : Symbol(createElement, Decl(react.d.ts, 0, 0))

export function Fragment(): void;
>Fragment : Symbol(Fragment, Decl(react.d.ts, 0, 38))

=== tests/cases/conformance/jsx/inline/preact.d.ts ===
export function h(): void;
>h : Symbol(h, Decl(preact.d.ts, 0, 0))

=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
export function h(): void;
>h : Symbol(h, Decl(snabbdom.d.ts, 0, 0))

export function Frag(): void;
>Frag : Symbol(Frag, Decl(snabbdom.d.ts, 0, 26))

=== tests/cases/conformance/jsx/inline/reacty.tsx ===
import {createElement, Fragment} from "./react";
>createElement : Symbol(createElement, Decl(reacty.tsx, 0, 8))
>Fragment : Symbol(Fragment, Decl(reacty.tsx, 0, 22))

<><span></span></>

=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
/**
* @jsx h
* @jsxFrag Frag
*/
import {h, Frag} from "./snabbdom";
>h : Symbol(h, Decl(snabbdomy.tsx, 4, 8))
>Frag : Symbol(Frag, Decl(snabbdomy.tsx, 4, 10))

<><div></div></>

=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
/* @jsx h */
/* @jsxFrag Frag */
import {h} from "./preact";
>h : Symbol(h, Decl(mix-n-match.tsx, 2, 8))

import {Frag} from "./snabbdom";
>Frag : Symbol(Frag, Decl(mix-n-match.tsx, 3, 8))

<><span></span></>
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
=== tests/cases/conformance/jsx/inline/jsx-globals.d.ts ===
declare global {
>global : typeof global

namespace JSX {
interface IntrinsicElements {
[e: string]: any;
>e : string
}
}
}

=== tests/cases/conformance/jsx/inline/react.d.ts ===
export function createElement(): void;
>createElement : () => void

export function Fragment(): void;
>Fragment : () => void

=== tests/cases/conformance/jsx/inline/preact.d.ts ===
export function h(): void;
>h : () => void

=== tests/cases/conformance/jsx/inline/snabbdom.d.ts ===
export function h(): void;
>h : () => void

export function Frag(): void;
>Frag : () => void

=== tests/cases/conformance/jsx/inline/reacty.tsx ===
import {createElement, Fragment} from "./react";
>createElement : () => void
>Fragment : () => void

<><span></span></>
><><span></span></> : any
><span></span> : any
>span : any
>span : any

=== tests/cases/conformance/jsx/inline/snabbdomy.tsx ===
/**
* @jsx h
* @jsxFrag Frag
*/
import {h, Frag} from "./snabbdom";
>h : () => void
>Frag : () => void

<><div></div></>
><><div></div></> : any
><div></div> : any
>div : any
>div : any

=== tests/cases/conformance/jsx/inline/mix-n-match.tsx ===
/* @jsx h */
/* @jsxFrag Frag */
import {h} from "./preact";
>h : () => void

import {Frag} from "./snabbdom";
>Frag : () => void

<><span></span></>
><><span></span></> : any
><span></span> : any
>span : any
>span : any

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// @jsx: react
// @jsxFactory: createElement
// @jsxFragmentFactory: Fragment

// @filename: jsx-globals.d.ts
declare global {
namespace JSX {
interface IntrinsicElements {
[e: string]: any;
}
}
}

// @filename: react.d.ts
export function createElement(): void;
export function Fragment(): void;

// @filename: preact.d.ts
export function h(): void;

// @filename: snabbdom.d.ts
export function h(): void;
export function Frag(): void;

// @filename: reacty.tsx
import {createElement, Fragment} from "./react";
<><span></span></>

// @filename: snabbdomy.tsx
/**
* @jsx h
* @jsxFrag Frag
*/
import {h, Frag} from "./snabbdom";
<><div></div></>

// @filename: mix-n-match.tsx
/* @jsx h */
/* @jsxFrag Frag */
import {h} from "./preact";
import {Frag} from "./snabbdom";
<><span></span></>

0 comments on commit 30a8f17

Please sign in to comment.