Add tests and baselines

This commit is contained in:
Yui T 2017-05-05 08:47:52 -07:00 committed by Kanchalai Tanglertsampan
parent 66b0b4415e
commit ddd5351525
15 changed files with 651 additions and 0 deletions

View File

@ -0,0 +1,60 @@
//// [file.tsx]
import React = require('react');
interface ButtonProp {
a: number,
b: string,
children: Button;
}
class Button extends React.Component<ButtonProp, any> {
render() {
return <InnerButton {...this.props} />
}
}
interface InnerButtonProp {
a: number
}
class InnerButton extends React.Component<InnerButtonProp, any> {
render() {
return (<button>Hello</button>);
}
}
//// [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 = (function (_super) {
__extends(Button, _super);
function Button() {
return _super !== null && _super.apply(this, arguments) || this;
}
Button.prototype.render = function () {
return <InnerButton {...this.props}/>;
};
return Button;
}(React.Component));
var InnerButton = (function (_super) {
__extends(InnerButton, _super);
function InnerButton() {
return _super !== null && _super.apply(this, arguments) || this;
}
InnerButton.prototype.render = function () {
return (<button>Hello</button>);
};
return InnerButton;
}(React.Component));

View File

@ -0,0 +1,59 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
interface ButtonProp {
>ButtonProp : Symbol(ButtonProp, Decl(file.tsx, 0, 32))
a: number,
>a : Symbol(ButtonProp.a, Decl(file.tsx, 2, 22))
b: string,
>b : Symbol(ButtonProp.b, Decl(file.tsx, 3, 14))
children: Button;
>children : Symbol(ButtonProp.children, Decl(file.tsx, 4, 14))
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
}
class Button extends React.Component<ButtonProp, any> {
>Button : Symbol(Button, Decl(file.tsx, 6, 1))
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
>React : Symbol(React, Decl(file.tsx, 0, 0))
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
>ButtonProp : Symbol(ButtonProp, Decl(file.tsx, 0, 32))
render() {
>render : Symbol(Button.render, Decl(file.tsx, 8, 55))
return <InnerButton {...this.props} />
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 16, 1))
>this.props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
>this : Symbol(Button, Decl(file.tsx, 6, 1))
>props : Symbol(React.Component.props, Decl(react.d.ts, 166, 37))
}
}
interface InnerButtonProp {
>InnerButtonProp : Symbol(InnerButtonProp, Decl(file.tsx, 12, 1))
a: number
>a : Symbol(InnerButtonProp.a, Decl(file.tsx, 14, 27))
}
class InnerButton extends React.Component<InnerButtonProp, any> {
>InnerButton : Symbol(InnerButton, Decl(file.tsx, 16, 1))
>React.Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
>React : Symbol(React, Decl(file.tsx, 0, 0))
>Component : Symbol(React.Component, Decl(react.d.ts, 158, 55))
>InnerButtonProp : Symbol(InnerButtonProp, Decl(file.tsx, 12, 1))
render() {
>render : Symbol(InnerButton.render, Decl(file.tsx, 18, 65))
return (<button>Hello</button>);
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
>button : Symbol(JSX.IntrinsicElements.button, Decl(react.d.ts, 2385, 43))
}
}

View File

@ -0,0 +1,62 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
interface ButtonProp {
>ButtonProp : ButtonProp
a: number,
>a : number
b: string,
>b : string
children: Button;
>children : Button
>Button : Button
}
class Button extends React.Component<ButtonProp, any> {
>Button : Button
>React.Component : React.Component<ButtonProp, any>
>React : typeof React
>Component : typeof React.Component
>ButtonProp : ButtonProp
render() {
>render : () => JSX.Element
return <InnerButton {...this.props} />
><InnerButton {...this.props} /> : JSX.Element
>InnerButton : typeof InnerButton
>this.props : ButtonProp & { children?: React.ReactNode; }
>this : this
>props : ButtonProp & { children?: React.ReactNode; }
}
}
interface InnerButtonProp {
>InnerButtonProp : InnerButtonProp
a: number
>a : number
}
class InnerButton extends React.Component<InnerButtonProp, any> {
>InnerButton : InnerButton
>React.Component : React.Component<InnerButtonProp, any>
>React : typeof React
>Component : typeof React.Component
>InnerButtonProp : InnerButtonProp
render() {
>render : () => JSX.Element
return (<button>Hello</button>);
>(<button>Hello</button>) : JSX.Element
><button>Hello</button> : JSX.Element
>button : any
>button : any
}
}

View File

@ -0,0 +1,36 @@
//// [file.tsx]
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
<AnotherComponent {...props} />
);
}
interface AnotherComponentProps {
property1: string;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}
//// [file.jsx]
"use strict";
exports.__esModule = true;
var React = require("react");
function Component(props) {
return (<AnotherComponent {...props}/>);
}
exports["default"] = Component;
function AnotherComponent(_a) {
var property1 = _a.property1;
return (<span>{property1}</span>);
}

View File

@ -0,0 +1,47 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
interface ComponentProps {
>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 0, 32))
property1: string;
>property1 : Symbol(ComponentProps.property1, Decl(file.tsx, 2, 26))
property2: number;
>property2 : Symbol(ComponentProps.property2, Decl(file.tsx, 3, 22))
}
export default function Component(props: ComponentProps) {
>Component : Symbol(Component, Decl(file.tsx, 5, 1))
>props : Symbol(props, Decl(file.tsx, 7, 34))
>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 0, 32))
return (
<AnotherComponent {...props} />
>AnotherComponent : Symbol(AnotherComponent, Decl(file.tsx, 15, 1))
>props : Symbol(props, Decl(file.tsx, 7, 34))
);
}
interface AnotherComponentProps {
>AnotherComponentProps : Symbol(AnotherComponentProps, Decl(file.tsx, 11, 1))
property1: string;
>property1 : Symbol(AnotherComponentProps.property1, Decl(file.tsx, 13, 33))
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
>AnotherComponent : Symbol(AnotherComponent, Decl(file.tsx, 15, 1))
>property1 : Symbol(property1, Decl(file.tsx, 17, 27))
>AnotherComponentProps : Symbol(AnotherComponentProps, Decl(file.tsx, 11, 1))
return (
<span>{property1}</span>
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
>property1 : Symbol(property1, Decl(file.tsx, 17, 27))
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
);
}

View File

@ -0,0 +1,53 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
interface ComponentProps {
>ComponentProps : ComponentProps
property1: string;
>property1 : string
property2: number;
>property2 : number
}
export default function Component(props: ComponentProps) {
>Component : (props: ComponentProps) => JSX.Element
>props : ComponentProps
>ComponentProps : ComponentProps
return (
>( <AnotherComponent {...props} /> ) : JSX.Element
<AnotherComponent {...props} />
><AnotherComponent {...props} /> : JSX.Element
>AnotherComponent : ({property1}: AnotherComponentProps) => JSX.Element
>props : ComponentProps
);
}
interface AnotherComponentProps {
>AnotherComponentProps : AnotherComponentProps
property1: string;
>property1 : string
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
>AnotherComponent : ({property1}: AnotherComponentProps) => JSX.Element
>property1 : string
>AnotherComponentProps : AnotherComponentProps
return (
>( <span>{property1}</span> ) : JSX.Element
<span>{property1}</span>
><span>{property1}</span> : JSX.Element
>span : any
>property1 : string
>span : any
);
}

View File

@ -0,0 +1,29 @@
tests/cases/conformance/jsx/file.tsx(11,38): error TS2339: Property 'Property1' does not exist on type 'IntrinsicAttributes & AnotherComponentProps'.
==== tests/cases/conformance/jsx/file.tsx (1 errors) ====
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
// Error extra property
<AnotherComponent {...props} Property1/>
~~~~~~~~~
!!! error TS2339: Property 'Property1' does not exist on type 'IntrinsicAttributes & AnotherComponentProps'.
);
}
interface AnotherComponentProps {
property1: string;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}

View File

@ -0,0 +1,39 @@
//// [file.tsx]
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
// Error extra property
<AnotherComponent {...props} Property1/>
);
}
interface AnotherComponentProps {
property1: string;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}
//// [file.jsx]
"use strict";
exports.__esModule = true;
var React = require("react");
function Component(props) {
return (
// Error extra property
<AnotherComponent {...props} Property1/>);
}
exports["default"] = Component;
function AnotherComponent(_a) {
var property1 = _a.property1;
return (<span>{property1}</span>);
}

View File

@ -0,0 +1,38 @@
//// [file.tsx]
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
<AnotherComponent {...props} property2 AnotherProperty1="hi"/>
);
}
interface AnotherComponentProps {
property1: string;
AnotherProperty1: string;
property2: boolean;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}
//// [file.jsx]
"use strict";
exports.__esModule = true;
var React = require("react");
function Component(props) {
return (<AnotherComponent {...props} property2 AnotherProperty1="hi"/>);
}
exports["default"] = Component;
function AnotherComponent(_a) {
var property1 = _a.property1;
return (<span>{property1}</span>);
}

View File

@ -0,0 +1,55 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
interface ComponentProps {
>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 0, 32))
property1: string;
>property1 : Symbol(ComponentProps.property1, Decl(file.tsx, 2, 26))
property2: number;
>property2 : Symbol(ComponentProps.property2, Decl(file.tsx, 3, 22))
}
export default function Component(props: ComponentProps) {
>Component : Symbol(Component, Decl(file.tsx, 5, 1))
>props : Symbol(props, Decl(file.tsx, 7, 34))
>ComponentProps : Symbol(ComponentProps, Decl(file.tsx, 0, 32))
return (
<AnotherComponent {...props} property2 AnotherProperty1="hi"/>
>AnotherComponent : Symbol(AnotherComponent, Decl(file.tsx, 17, 1))
>props : Symbol(props, Decl(file.tsx, 7, 34))
>property2 : Symbol(property2, Decl(file.tsx, 9, 36))
>AnotherProperty1 : Symbol(AnotherProperty1, Decl(file.tsx, 9, 46))
);
}
interface AnotherComponentProps {
>AnotherComponentProps : Symbol(AnotherComponentProps, Decl(file.tsx, 11, 1))
property1: string;
>property1 : Symbol(AnotherComponentProps.property1, Decl(file.tsx, 13, 33))
AnotherProperty1: string;
>AnotherProperty1 : Symbol(AnotherComponentProps.AnotherProperty1, Decl(file.tsx, 14, 22))
property2: boolean;
>property2 : Symbol(AnotherComponentProps.property2, Decl(file.tsx, 15, 29))
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
>AnotherComponent : Symbol(AnotherComponent, Decl(file.tsx, 17, 1))
>property1 : Symbol(property1, Decl(file.tsx, 19, 27))
>AnotherComponentProps : Symbol(AnotherComponentProps, Decl(file.tsx, 11, 1))
return (
<span>{property1}</span>
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
>property1 : Symbol(property1, Decl(file.tsx, 19, 27))
>span : Symbol(JSX.IntrinsicElements.span, Decl(react.d.ts, 2460, 51))
);
}

View File

@ -0,0 +1,61 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
interface ComponentProps {
>ComponentProps : ComponentProps
property1: string;
>property1 : string
property2: number;
>property2 : number
}
export default function Component(props: ComponentProps) {
>Component : (props: ComponentProps) => JSX.Element
>props : ComponentProps
>ComponentProps : ComponentProps
return (
>( <AnotherComponent {...props} property2 AnotherProperty1="hi"/> ) : JSX.Element
<AnotherComponent {...props} property2 AnotherProperty1="hi"/>
><AnotherComponent {...props} property2 AnotherProperty1="hi"/> : JSX.Element
>AnotherComponent : ({property1}: AnotherComponentProps) => JSX.Element
>props : ComponentProps
>property2 : true
>AnotherProperty1 : string
);
}
interface AnotherComponentProps {
>AnotherComponentProps : AnotherComponentProps
property1: string;
>property1 : string
AnotherProperty1: string;
>AnotherProperty1 : string
property2: boolean;
>property2 : boolean
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
>AnotherComponent : ({property1}: AnotherComponentProps) => JSX.Element
>property1 : string
>AnotherComponentProps : AnotherComponentProps
return (
>( <span>{property1}</span> ) : JSX.Element
<span>{property1}</span>
><span>{property1}</span> : JSX.Element
>span : any
>property1 : string
>span : any
);
}

View File

@ -0,0 +1,28 @@
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
interface ButtonProp {
a: number,
b: string,
children: Button;
}
class Button extends React.Component<ButtonProp, any> {
render() {
return <InnerButton {...this.props} />
}
}
interface InnerButtonProp {
a: number
}
class InnerButton extends React.Component<InnerButtonProp, any> {
render() {
return (<button>Hello</button>);
}
}

View File

@ -0,0 +1,27 @@
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
<AnotherComponent {...props} />
);
}
interface AnotherComponentProps {
property1: string;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}

View File

@ -0,0 +1,28 @@
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
// Error extra property
<AnotherComponent {...props} Property1/>
);
}
interface AnotherComponentProps {
property1: string;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}

View File

@ -0,0 +1,29 @@
// @filename: file.tsx
// @jsx: preserve
// @noLib: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
interface ComponentProps {
property1: string;
property2: number;
}
export default function Component(props: ComponentProps) {
return (
<AnotherComponent {...props} property2 AnotherProperty1="hi"/>
);
}
interface AnotherComponentProps {
property1: string;
AnotherProperty1: string;
property2: boolean;
}
function AnotherComponent({ property1 }: AnotherComponentProps) {
return (
<span>{property1}</span>
);
}