mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-22 16:52:14 -06:00
Update tests and baselines
This commit is contained in:
parent
c778a48703
commit
dbf2a96a7e
@ -27,8 +27,7 @@ let k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
|
||||
16
tests/baselines/reference/checkJsxChildrenProperty9.js
Normal file
16
tests/baselines/reference/checkJsxChildrenProperty9.js
Normal file
@ -0,0 +1,16 @@
|
||||
//// [file.tsx]
|
||||
import React = require('react');
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
|
||||
//// [file.jsx]
|
||||
"use strict";
|
||||
exports.__esModule = true;
|
||||
var React = require("react");
|
||||
// OK
|
||||
var k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
var k2 = <div> <h2> Hello </h2> {function (user) { return <h2>{user.name}</h2>; }}</div>;
|
||||
var k3 = <div> {1} {"That is a number"} </div>;
|
||||
30
tests/baselines/reference/checkJsxChildrenProperty9.symbols
Normal file
30
tests/baselines/reference/checkJsxChildrenProperty9.symbols
Normal file
@ -0,0 +1,30 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : Symbol(k1, Decl(file.tsx, 3, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2407, 47))
|
||||
>h1 : Symbol(JSX.IntrinsicElements.h1, Decl(react.d.ts, 2407, 47))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : Symbol(k2, Decl(file.tsx, 4, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>user : Symbol(user, Decl(file.tsx, 4, 34))
|
||||
>h2 : Symbol(JSX.IntrinsicElements.h2, Decl(react.d.ts, 2408, 48))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : Symbol(k3, Decl(file.tsx, 5, 3))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
>div : Symbol(JSX.IntrinsicElements.div, Decl(react.d.ts, 2397, 45))
|
||||
|
||||
42
tests/baselines/reference/checkJsxChildrenProperty9.types
Normal file
42
tests/baselines/reference/checkJsxChildrenProperty9.types
Normal file
@ -0,0 +1,42 @@
|
||||
=== tests/cases/conformance/jsx/file.tsx ===
|
||||
import React = require('react');
|
||||
>React : typeof React
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
>k1 : JSX.Element
|
||||
><div> <h2> Hello </h2> <h1> world </h1></div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
><h1> world </h1> : JSX.Element
|
||||
>h1 : any
|
||||
>h1 : any
|
||||
>div : any
|
||||
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
>k2 : JSX.Element
|
||||
><div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div> : JSX.Element
|
||||
>div : any
|
||||
><h2> Hello </h2> : JSX.Element
|
||||
>h2 : any
|
||||
>h2 : any
|
||||
>(user: any) => <h2>{user.name}</h2> : (user: any) => JSX.Element
|
||||
>user : any
|
||||
><h2>{user.name}</h2> : JSX.Element
|
||||
>h2 : any
|
||||
>user.name : any
|
||||
>user : any
|
||||
>name : any
|
||||
>h2 : any
|
||||
>div : any
|
||||
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
>k3 : JSX.Element
|
||||
><div> {1} {"That is a number"} </div> : JSX.Element
|
||||
>div : any
|
||||
>1 : 1
|
||||
>"That is a number" : "That is a number"
|
||||
>div : any
|
||||
|
||||
@ -33,9 +33,7 @@ tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type '{ y1: "hello";
|
||||
tests/cases/conformance/jsx/file.tsx(35,29): error TS2322: Type '{ y1: "hello"; y2: 1000; children: "hi"; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type '{ y1: "hello"; y2: 1000; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Type '{ y1: "hello"; y2: 1000; children: string; }' is not assignable to type '{ y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Types of property 'y1' are incompatible.
|
||||
Type '"hello"' is not assignable to type 'boolean'.
|
||||
Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (12 errors) ====
|
||||
@ -122,7 +120,5 @@ tests/cases/conformance/jsx/file.tsx(36,29): error TS2322: Type '{ y1: "hello";
|
||||
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ y1: "hello"; y2: 1000; children: string; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
!!! error TS2322: Type '{ y1: "hello"; y2: 1000; children: string; }' is not assignable to type '{ y1: boolean; y2?: number; y3: boolean; }'.
|
||||
!!! error TS2322: Types of property 'y1' are incompatible.
|
||||
!!! error TS2322: Type '"hello"' is not assignable to type 'boolean'.
|
||||
!!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
|
||||
@ -1,9 +1,7 @@
|
||||
tests/cases/conformance/jsx/file.tsx(48,24): error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'HyphenProps'.
|
||||
Property '"data-format"' is missing in type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }'.
|
||||
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
|
||||
tests/cases/conformance/jsx/file.tsx(49,24): error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'HyphenProps'.
|
||||
Property '"data-format"' is missing in type '{ to: string; onClick: (e: any) => void; children: string; }'.
|
||||
Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
|
||||
tests/cases/conformance/jsx/file.tsx(50,24): error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
Property 'onClick' does not exist on type 'IntrinsicAttributes & HyphenProps'.
|
||||
tests/cases/conformance/jsx/file.tsx(51,24): error TS2322: Type '{ onClick: (k: MouseEvent<any>) => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
@ -71,13 +69,11 @@ tests/cases/conformance/jsx/file.tsx(56,24): error TS2322: Type '{ data-format:
|
||||
const b0 = <MainButton to='/some/path' onClick={(e)=>{}}>GO</MainButton>; // extra property;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
!!! error TS2322: Type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }' is not assignable to type 'HyphenProps'.
|
||||
!!! error TS2322: Property '"data-format"' is missing in type '{ to: "/some/path"; onClick: (e: MouseEvent<any>) => void; children: string; }'.
|
||||
!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
|
||||
const b1 = <MainButton onClick={(e: any)=> {}} {...obj0}>Hello world</MainButton>; // extra property;
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
!!! error TS2322: Type '{ to: string; onClick: (e: any) => void; children: string; }' is not assignable to type 'HyphenProps'.
|
||||
!!! error TS2322: Property '"data-format"' is missing in type '{ to: string; onClick: (e: any) => void; children: string; }'.
|
||||
!!! error TS2322: Property 'to' does not exist on type 'IntrinsicAttributes & HyphenProps'.
|
||||
const b2 = <MainButton {...{to: "10000"}} {...obj2} />; // extra property
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ onClick: () => void; to: string; }' is not assignable to type 'IntrinsicAttributes & HyphenProps'.
|
||||
|
||||
@ -31,4 +31,4 @@ let k2 = <Comp a={10} b="hi"><Button />
|
||||
<AnotherButton /> </Comp>;
|
||||
let k3 = <Comp a={10} b="hi"> <Button />
|
||||
<AnotherButton /></Comp>;
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
let k4 = <Comp a={10} b="hi"><Button /> </Comp>;
|
||||
11
tests/cases/conformance/jsx/checkJsxChildrenProperty9.tsx
Normal file
11
tests/cases/conformance/jsx/checkJsxChildrenProperty9.tsx
Normal file
@ -0,0 +1,11 @@
|
||||
// @filename: file.tsx
|
||||
// @jsx: preserve
|
||||
// @noLib: true
|
||||
// @libFiles: react.d.ts,lib.d.ts
|
||||
|
||||
import React = require('react');
|
||||
|
||||
// OK
|
||||
let k1 = <div> <h2> Hello </h2> <h1> world </h1></div>;
|
||||
let k2 = <div> <h2> Hello </h2> {(user: any) => <h2>{user.name}</h2>}</div>;
|
||||
let k3 = <div> {1} {"That is a number"} </div>;
|
||||
6
tests/lib/react.d.ts
vendored
6
tests/lib/react.d.ts
vendored
@ -2359,7 +2359,11 @@ declare namespace JSX {
|
||||
interface ElementClass extends React.Component<any, any> {
|
||||
render(): JSX.Element | null;
|
||||
}
|
||||
interface ElementAttributesProperty { props: {}; }
|
||||
interface ElementAttributesProperty {
|
||||
props: {
|
||||
children: any;
|
||||
};
|
||||
}
|
||||
|
||||
interface IntrinsicAttributes extends React.Attributes { }
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user