mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-18 22:45:50 -06:00
Add baselines
This commit is contained in:
parent
269d37a2e6
commit
5f8a1b5b56
@ -0,0 +1,56 @@
|
||||
tests/cases/conformance/jsx/file.tsx(42,27): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'.
|
||||
Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'SingleChildProp'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type 'Element[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type 'Element[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
|
||||
let k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
|
||||
let k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
|
||||
|
||||
interface SingleChildProp {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
function SingleChildComp(p: SingleChildProp) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
|
||||
// Error
|
||||
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & SingleChildProp'.
|
||||
!!! error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'SingleChildProp'.
|
||||
!!! error TS2322: Types of property 'children' are incompatible.
|
||||
!!! error TS2322: Type 'Element[]' is not assignable to type 'Element'.
|
||||
!!! error TS2322: Property 'type' is missing in type 'Element[]'.
|
||||
85
tests/baselines/reference/checkJsxChildrenProperty14.js
Normal file
85
tests/baselines/reference/checkJsxChildrenProperty14.js
Normal file
@ -0,0 +1,85 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element | JSX.Element[];
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
render() {
|
||||
return (<div>My Button</div>)
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
|
||||
let k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
|
||||
let k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
|
||||
|
||||
interface SingleChildProp {
|
||||
a: number,
|
||||
b: string,
|
||||
children: JSX.Element;
|
||||
}
|
||||
|
||||
function SingleChildComp(p: SingleChildProp) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
|
||||
// OK
|
||||
let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
|
||||
// Error
|
||||
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
var Button = /** @class */ (function (_super) {
|
||||
__extends(Button, _super);
|
||||
function Button() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
Button.prototype.render = function () {
|
||||
return (<div>My Button</div>);
|
||||
};
|
||||
return Button;
|
||||
}(React.Component));
|
||||
function AnotherButton(p) {
|
||||
return <h1>Just Another Button</h1>;
|
||||
}
|
||||
function Comp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// OK
|
||||
var k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
|
||||
var k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
|
||||
var k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
|
||||
function SingleChildComp(p) {
|
||||
return <div>{p.b}</div>;
|
||||
}
|
||||
// OK
|
||||
var k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
// Error
|
||||
var k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
134
tests/baselines/reference/checkJsxChildrenProperty14.symbols
Normal file
134
tests/baselines/reference/checkJsxChildrenProperty14.symbols
Normal file
@ -0,0 +1,134 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Prop {
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
a: number,
|
||||
>a : Symbol(Prop.a, Decl(file.tsx, 2, 16))
|
||||
|
||||
b: string,
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
|
||||
children: JSX.Element | JSX.Element[];
|
||||
>children : Symbol(Prop.children, Decl(file.tsx, 4, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55), Decl(react.d.ts, 161, 66))
|
||||
|
||||
render() {
|
||||
>render : Symbol(Button.render, Decl(file.tsx, 8, 48))
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 14, 23))
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2410, 47))
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>Prop : Symbol(Prop, Decl(file.tsx, 0, 32))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>p.b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 18, 14))
|
||||
>b : Symbol(Prop.b, Decl(file.tsx, 3, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 23, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 23, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 23, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 24, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 24, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 24, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
let k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 25, 3))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 25, 14))
|
||||
>b : Symbol(b, Decl(file.tsx, 25, 21))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>Comp : Symbol(Comp, Decl(file.tsx, 16, 1))
|
||||
|
||||
interface SingleChildProp {
|
||||
>SingleChildProp : Symbol(SingleChildProp, Decl(file.tsx, 25, 69))
|
||||
|
||||
a: number,
|
||||
>a : Symbol(SingleChildProp.a, Decl(file.tsx, 27, 27))
|
||||
|
||||
b: string,
|
||||
>b : Symbol(SingleChildProp.b, Decl(file.tsx, 28, 14))
|
||||
|
||||
children: JSX.Element;
|
||||
>children : Symbol(SingleChildProp.children, Decl(file.tsx, 29, 14))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2353, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2356, 27))
|
||||
}
|
||||
|
||||
function SingleChildComp(p: SingleChildProp) {
|
||||
>SingleChildComp : Symbol(SingleChildComp, Decl(file.tsx, 31, 1))
|
||||
>p : Symbol(p, Decl(file.tsx, 33, 25))
|
||||
>SingleChildProp : Symbol(SingleChildProp, Decl(file.tsx, 25, 69))
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
>p.b : Symbol(SingleChildProp.b, Decl(file.tsx, 28, 14))
|
||||
>p : Symbol(p, Decl(file.tsx, 33, 25))
|
||||
>b : Symbol(SingleChildProp.b, Decl(file.tsx, 28, 14))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2400, 45))
|
||||
}
|
||||
|
||||
// OK
|
||||
let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
>k4 : Symbol(k4, Decl(file.tsx, 38, 3))
|
||||
>SingleChildComp : Symbol(SingleChildComp, Decl(file.tsx, 31, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 38, 25))
|
||||
>b : Symbol(b, Decl(file.tsx, 38, 32))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>SingleChildComp : Symbol(SingleChildComp, Decl(file.tsx, 31, 1))
|
||||
|
||||
// Error
|
||||
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
>k5 : Symbol(k5, Decl(file.tsx, 41, 3))
|
||||
>SingleChildComp : Symbol(SingleChildComp, Decl(file.tsx, 31, 1))
|
||||
>a : Symbol(a, Decl(file.tsx, 41, 25))
|
||||
>b : Symbol(b, Decl(file.tsx, 41, 32))
|
||||
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
|
||||
>AnotherButton : Symbol(AnotherButton, Decl(file.tsx, 12, 1))
|
||||
>SingleChildComp : Symbol(SingleChildComp, Decl(file.tsx, 31, 1))
|
||||
|
||||
164
tests/baselines/reference/checkJsxChildrenProperty14.types
Normal file
164
tests/baselines/reference/checkJsxChildrenProperty14.types
Normal file
@ -0,0 +1,164 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
interface Prop {
|
||||
>Prop : Prop
|
||||
|
||||
a: number,
|
||||
>a : number
|
||||
|
||||
b: string,
|
||||
>b : string
|
||||
|
||||
children: JSX.Element | JSX.Element[];
|
||||
>children : JSX.Element | JSX.Element[]
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
class Button extends React.Component<any, any> {
|
||||
>Button : Button
|
||||
>React.Component : React.Component<any, any>
|
||||
>React : typeof React
|
||||
>Component : typeof React.Component
|
||||
|
||||
render() {
|
||||
>render : () => JSX.Element
|
||||
|
||||
return (<div>My Button</div>)
|
||||
>(<div>My Button</div>) : JSX.Element
|
||||
><div>My Button</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
}
|
||||
}
|
||||
|
||||
function AnotherButton(p: any) {
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>p : any
|
||||
|
||||
return <h1>Just Another Button</h1>;
|
||||
><h1>Just Another Button</h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
}
|
||||
|
||||
function Comp(p: Prop) {
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>p : Prop
|
||||
>Prop : Prop
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
><div>{p.b}</div> : JSX.Element
|
||||
>div : any
|
||||
>p.b : string
|
||||
>p : Prop
|
||||
>b : string
|
||||
>div : any
|
||||
}
|
||||
|
||||
// OK
|
||||
let k1 = <Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp>;
|
||||
>k1 : JSX.Element
|
||||
><Comp a={10} b="hi"><></><Button /><AnotherButton /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><></> : JSX.Element
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k2 = <Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp>;
|
||||
>k2 : JSX.Element
|
||||
><Comp a={10} b="hi"><><Button /></><AnotherButton /></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><><Button /></> : JSX.Element
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
let k3 = <Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp>;
|
||||
>k3 : JSX.Element
|
||||
><Comp a={10} b="hi"><><Button /><AnotherButton /></></Comp> : JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><><Button /><AnotherButton /></> : JSX.Element
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>Comp : (p: Prop) => JSX.Element
|
||||
|
||||
interface SingleChildProp {
|
||||
>SingleChildProp : SingleChildProp
|
||||
|
||||
a: number,
|
||||
>a : number
|
||||
|
||||
b: string,
|
||||
>b : string
|
||||
|
||||
children: JSX.Element;
|
||||
>children : JSX.Element
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
}
|
||||
|
||||
function SingleChildComp(p: SingleChildProp) {
|
||||
>SingleChildComp : (p: SingleChildProp) => JSX.Element
|
||||
>p : SingleChildProp
|
||||
>SingleChildProp : SingleChildProp
|
||||
|
||||
return <div>{p.b}</div>;
|
||||
><div>{p.b}</div> : JSX.Element
|
||||
>div : any
|
||||
>p.b : string
|
||||
>p : SingleChildProp
|
||||
>b : string
|
||||
>div : any
|
||||
}
|
||||
|
||||
// OK
|
||||
let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
>k4 : JSX.Element
|
||||
><SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp> : JSX.Element
|
||||
>SingleChildComp : (p: SingleChildProp) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><><Button /><AnotherButton /></> : JSX.Element
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>SingleChildComp : (p: SingleChildProp) => JSX.Element
|
||||
|
||||
// Error
|
||||
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
>k5 : JSX.Element
|
||||
><SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp> : JSX.Element
|
||||
>SingleChildComp : (p: SingleChildProp) => JSX.Element
|
||||
>a : number
|
||||
>10 : 10
|
||||
>b : string
|
||||
><></> : JSX.Element
|
||||
><Button /> : JSX.Element
|
||||
>Button : typeof Button
|
||||
><AnotherButton /> : JSX.Element
|
||||
>AnotherButton : (p: any) => JSX.Element
|
||||
>SingleChildComp : (p: SingleChildProp) => JSX.Element
|
||||
|
||||
25
tests/baselines/reference/tsxFragmentErrors.errors.txt
Normal file
25
tests/baselines/reference/tsxFragmentErrors.errors.txt
Normal file
@ -0,0 +1,25 @@
|
||||
tests/cases/conformance/jsx/file.tsx(9,7): error TS17015: Expected corresponding JSX fragment closing tag.
|
||||
tests/cases/conformance/jsx/file.tsx(9,11): error TS17014: JSX fragment has no corresponding closing tag.
|
||||
tests/cases/conformance/jsx/file.tsx(11,17): error TS1005: '</' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (3 errors) ====
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
[s: string]: any;
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
|
||||
<>hi</div> // Error
|
||||
~~~
|
||||
!!! error TS17015: Expected corresponding JSX fragment closing tag.
|
||||
~~~~~~~~~
|
||||
|
||||
|
||||
<>eof // Error
|
||||
~~
|
||||
!!! error TS17014: JSX fragment has no corresponding closing tag.
|
||||
|
||||
!!! error TS1005: '</' expected.
|
||||
17
tests/baselines/reference/tsxFragmentErrors.js
Normal file
17
tests/baselines/reference/tsxFragmentErrors.js
Normal file
@ -0,0 +1,17 @@
|
||||
//// [file.tsx]
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
[s: string]: any;
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
|
||||
<>hi</div> // Error
|
||||
|
||||
<>eof // Error
|
||||
|
||||
//// [file.js]
|
||||
React.createElement(React.Fragment, null, "hi") // Error
|
||||
, // Error
|
||||
React.createElement(React.Fragment, null, "eof // Error");
|
||||
20
tests/baselines/reference/tsxFragmentErrors.symbols
Normal file
20
tests/baselines/reference/tsxFragmentErrors.symbols
Normal file
@ -0,0 +1,20 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(file.tsx, 0, 20))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
[s: string]: any;
|
||||
>s : Symbol(s, Decl(file.tsx, 3, 3))
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : Symbol(React, Decl(file.tsx, 6, 11))
|
||||
|
||||
<>hi</div> // Error
|
||||
|
||||
<>eof // Error
|
||||
24
tests/baselines/reference/tsxFragmentErrors.types
Normal file
24
tests/baselines/reference/tsxFragmentErrors.types
Normal file
@ -0,0 +1,24 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
|
||||
[s: string]: any;
|
||||
>s : string
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : any
|
||||
|
||||
<>hi</div> // Error
|
||||
><>hi</div> // Error<>eof // Error : JSX.Element
|
||||
><>hi</div> : JSX.Element
|
||||
|
||||
<>eof // Error
|
||||
><>eof // Error : JSX.Element
|
||||
|
||||
23
tests/baselines/reference/tsxFragmentPreserveEmit.js
Normal file
23
tests/baselines/reference/tsxFragmentPreserveEmit.js
Normal file
@ -0,0 +1,23 @@
|
||||
//// [file.tsx]
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
[s: string]: any;
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
|
||||
<></>; // no whitespace
|
||||
< ></ >; // lots of whitespace
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
<>hi</>; // text inside
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
|
||||
//// [file.jsx]
|
||||
<></>; // no whitespace
|
||||
<></>; // lots of whitespace
|
||||
<></>; // comments in the tags
|
||||
<>hi</>; // text inside
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
37
tests/baselines/reference/tsxFragmentPreserveEmit.symbols
Normal file
37
tests/baselines/reference/tsxFragmentPreserveEmit.symbols
Normal file
@ -0,0 +1,37 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(file.tsx, 0, 20))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
[s: string]: any;
|
||||
>s : Symbol(s, Decl(file.tsx, 3, 3))
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : Symbol(React, Decl(file.tsx, 6, 11))
|
||||
|
||||
<></>; // no whitespace
|
||||
< ></ >; // lots of whitespace
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
<>hi</>; // text inside
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
54
tests/baselines/reference/tsxFragmentPreserveEmit.types
Normal file
54
tests/baselines/reference/tsxFragmentPreserveEmit.types
Normal file
@ -0,0 +1,54 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
|
||||
[s: string]: any;
|
||||
>s : string
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : any
|
||||
|
||||
<></>; // no whitespace
|
||||
><></> : JSX.Element
|
||||
|
||||
< ></ >; // lots of whitespace
|
||||
>< ></ > : JSX.Element
|
||||
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
>< /*starting wrap*/ ></ /*ending wrap*/> : JSX.Element
|
||||
|
||||
<>hi</>; // text inside
|
||||
><>hi</> : JSX.Element
|
||||
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
><><span>hi</span><div>bye</div></> : JSX.Element
|
||||
><span>hi</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><div>bye</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></> : JSX.Element
|
||||
><span>1</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : JSX.Element
|
||||
><span>2.1</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><span>3</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
30
tests/baselines/reference/tsxFragmentReactEmit.js
Normal file
30
tests/baselines/reference/tsxFragmentReactEmit.js
Normal file
@ -0,0 +1,30 @@
|
||||
//// [file.tsx]
|
||||
declare module JSX {
|
||||
interface Element { }
|
||||
interface IntrinsicElements {
|
||||
[s: string]: any;
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
|
||||
<></>; // no whitespace
|
||||
< ></ >; // lots of whitespace
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
<>hi</>; // text inside
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
|
||||
//// [file.js]
|
||||
React.createElement(React.Fragment, null); // no whitespace
|
||||
React.createElement(React.Fragment, null); // lots of whitespace
|
||||
React.createElement(React.Fragment, null); // comments in the tags
|
||||
React.createElement(React.Fragment, null, "hi"); // text inside
|
||||
React.createElement(React.Fragment, null,
|
||||
React.createElement("span", null, "hi"),
|
||||
React.createElement("div", null, "bye")); // children
|
||||
React.createElement(React.Fragment, null,
|
||||
React.createElement("span", null, "1"),
|
||||
React.createElement(React.Fragment, null,
|
||||
React.createElement("span", null, "2.1"),
|
||||
React.createElement("span", null, "2.2")),
|
||||
React.createElement("span", null, "3")); // nested fragments
|
||||
37
tests/baselines/reference/tsxFragmentReactEmit.symbols
Normal file
37
tests/baselines/reference/tsxFragmentReactEmit.symbols
Normal file
@ -0,0 +1,37 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
|
||||
|
||||
interface Element { }
|
||||
>Element : Symbol(Element, Decl(file.tsx, 0, 20))
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
[s: string]: any;
|
||||
>s : Symbol(s, Decl(file.tsx, 3, 3))
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : Symbol(React, Decl(file.tsx, 6, 11))
|
||||
|
||||
<></>; // no whitespace
|
||||
< ></ >; // lots of whitespace
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
<>hi</>; // text inside
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>div : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
>span : Symbol(JSX.IntrinsicElements, Decl(file.tsx, 1, 22))
|
||||
|
||||
54
tests/baselines/reference/tsxFragmentReactEmit.types
Normal file
54
tests/baselines/reference/tsxFragmentReactEmit.types
Normal file
@ -0,0 +1,54 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
declare module JSX {
|
||||
>JSX : any
|
||||
|
||||
interface Element { }
|
||||
>Element : Element
|
||||
|
||||
interface IntrinsicElements {
|
||||
>IntrinsicElements : IntrinsicElements
|
||||
|
||||
[s: string]: any;
|
||||
>s : string
|
||||
}
|
||||
}
|
||||
declare var React: any;
|
||||
>React : any
|
||||
|
||||
<></>; // no whitespace
|
||||
><></> : JSX.Element
|
||||
|
||||
< ></ >; // lots of whitespace
|
||||
>< ></ > : JSX.Element
|
||||
|
||||
< /*starting wrap*/ ></ /*ending wrap*/>; // comments in the tags
|
||||
>< /*starting wrap*/ ></ /*ending wrap*/> : JSX.Element
|
||||
|
||||
<>hi</>; // text inside
|
||||
><>hi</> : JSX.Element
|
||||
|
||||
<><span>hi</span><div>bye</div></>; // children
|
||||
><><span>hi</span><div>bye</div></> : JSX.Element
|
||||
><span>hi</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><div>bye</div> : JSX.Element
|
||||
>div : any
|
||||
>div : any
|
||||
|
||||
<><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></>; // nested fragments
|
||||
><><span>1</span><><span>2.1</span><span>2.2</span></><span>3</span></> : JSX.Element
|
||||
><span>1</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><><span>2.1</span><span>2.2</span></> : JSX.Element
|
||||
><span>2.1</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><span>2.2</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
><span>3</span> : JSX.Element
|
||||
>span : any
|
||||
>span : any
|
||||
|
||||
@ -44,5 +44,5 @@ function SingleChildComp(p: SingleChildProp) {
|
||||
// OK
|
||||
let k4 = <SingleChildComp a={10} b="hi"><><Button /><AnotherButton /></></SingleChildComp>;
|
||||
|
||||
// Errors
|
||||
// Error
|
||||
let k5 = <SingleChildComp a={10} b="hi"><></><Button /><AnotherButton /></SingleChildComp>;
|
||||
Loading…
x
Reference in New Issue
Block a user