Add tests and update baselines
This commit is contained in:
parent
012f459594
commit
58e2189f45
|
@ -1,4 +1,4 @@
|
|||
/// <reference path="core.ts"/>
|
||||
/// <reference path="core.ts"/>
|
||||
/// <reference path="diagnosticInformationMap.generated.ts"/>
|
||||
|
||||
namespace ts {
|
||||
|
|
|
@ -2,25 +2,26 @@ tests/cases/conformance/jsx/file.tsx(14,15): error TS2322: Type '{ a: 10; b: "hi
|
|||
Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(17,11): error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
|
||||
tests/cases/conformance/jsx/file.tsx(23,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
tests/cases/conformance/jsx/file.tsx(25,11): error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
|
||||
tests/cases/conformance/jsx/file.tsx(31,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (Element | ((name: string) => Element))[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'string | Element'.
|
||||
Type '(Element | ((name: string) => Element))[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(Element | ((name: string) => Element))[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(29,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
tests/cases/conformance/jsx/file.tsx(37,11): error TS2322: Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (Element | 1000000)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(Element | 1000000)[]' is not assignable to type 'string | Element'.
|
||||
Type '(Element | 1000000)[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(Element | 1000000)[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(35,11): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
tests/cases/conformance/jsx/file.tsx(43,11): error TS2322: Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: (string | Element)[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type '(string | Element)[]' is not assignable to type 'string | Element'.
|
||||
Type '(string | Element)[]' is not assignable to type 'Element'.
|
||||
Property 'type' is missing in type '(string | Element)[]'.
|
||||
tests/cases/conformance/jsx/file.tsx(41,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
tests/cases/conformance/jsx/file.tsx(49,11): error TS2322: Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'IntrinsicAttributes & Prop'.
|
||||
Type '{ a: 10; b: "hi"; children: Element[]; }' is not assignable to type 'Prop'.
|
||||
Types of property 'children' are incompatible.
|
||||
Type 'Element[]' is not assignable to type 'string | Element'.
|
||||
|
@ -28,7 +29,7 @@ tests/cases/conformance/jsx/file.tsx(41,11): error TS2322: Type '{ a: 10; b: "hi
|
|||
Property 'type' is missing in type 'Element[]'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (6 errors) ====
|
||||
==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
|
||||
import React = require('react');
|
||||
|
||||
interface Prop {
|
||||
|
@ -48,13 +49,23 @@ tests/cases/conformance/jsx/file.tsx(41,11): error TS2322: Type '{ a: 10; b: "hi
|
|||
!!! error TS2322: Type '{ a: 10; b: "hi"; }' is not assignable to type 'Prop'.
|
||||
!!! error TS2322: Property 'children' is missing in type '{ a: 10; b: "hi"; }'.
|
||||
|
||||
let k1 =
|
||||
let k0 =
|
||||
<Comp a={10} b="hi" children="Random" >
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let o = {
|
||||
children:"Random"
|
||||
}
|
||||
let k1 =
|
||||
<Comp a={10} b="hi" {...o} >
|
||||
~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten.
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
// Error: incorrect type
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
|
|
|
@ -14,11 +14,19 @@ function Comp(p: Prop) {
|
|||
// Error: missing children
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
|
||||
let k1 =
|
||||
let k0 =
|
||||
<Comp a={10} b="hi" children="Random" >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let o = {
|
||||
children:"Random"
|
||||
}
|
||||
let k1 =
|
||||
<Comp a={10} b="hi" {...o} >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
// Error: incorrect type
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
|
@ -53,7 +61,13 @@ function Comp(p) {
|
|||
}
|
||||
// Error: missing children
|
||||
var k = <Comp a={10} b="hi"/>;
|
||||
var k1 = <Comp a={10} b="hi" children="Random">
|
||||
var k0 = <Comp a={10} b="hi" children="Random">
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
var o = {
|
||||
children: "Random"
|
||||
};
|
||||
var k1 = <Comp a={10} b="hi" {...o}>
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
// Error: incorrect type
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
import React = require('react')
|
||||
|
||||
declare function OneThing(k: {yxx: string}): JSX.Element;
|
||||
declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
|
||||
declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
|
||||
|
@ -11,6 +12,8 @@ const c1 = <OneThing yxx='ok' />
|
|||
const c2 = <OneThing yy={100} yy1="hello"/>
|
||||
const c3 = <OneThing yxx="hello" ignore-prop />
|
||||
const c4 = <OneThing data="hello" data-prop />
|
||||
const c5 = <OneThing yxx1='ok'>Hello</OneThing>
|
||||
|
||||
|
||||
declare function TestingOneThing({y1: string}): JSX.Element;
|
||||
declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element;
|
||||
|
@ -48,6 +51,7 @@ define(["require", "exports", "react"], function (require, exports, React) {
|
|||
var c2 = <OneThing yy={100} yy1="hello"/>;
|
||||
var c3 = <OneThing yxx="hello" ignore-prop/>;
|
||||
var c4 = <OneThing data="hello" data-prop/>;
|
||||
var c5 = <OneThing yxx1='ok'>Hello</OneThing>;
|
||||
// OK
|
||||
var d1 = <TestingOneThing y1 extra-data/>;
|
||||
var d2 = <TestingOneThing extra-data="hello"/>;
|
||||
|
|
|
@ -3,173 +3,188 @@ import React = require('react')
|
|||
>React : Symbol(React, Decl(file.tsx, 0, 0))
|
||||
|
||||
declare function OneThing(k: {yxx: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>k : Symbol(k, Decl(file.tsx, 2, 26))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 2, 30))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>k : Symbol(k, Decl(file.tsx, 3, 26))
|
||||
>yxx1 : Symbol(yxx1, Decl(file.tsx, 3, 30))
|
||||
>children : Symbol(children, Decl(file.tsx, 3, 43))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>l : Symbol(l, Decl(file.tsx, 3, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 3, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 3, 41))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>l : Symbol(l, Decl(file.tsx, 4, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 4, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 4, 41))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>l : Symbol(l, Decl(file.tsx, 4, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 4, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 4, 41))
|
||||
>yy2 : Symbol(yy2, Decl(file.tsx, 4, 54))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>l : Symbol(l, Decl(file.tsx, 5, 26))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 5, 30))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 5, 41))
|
||||
>yy2 : Symbol(yy2, Decl(file.tsx, 5, 54))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>l1 : Symbol(l1, Decl(file.tsx, 5, 26))
|
||||
>data : Symbol(data, Decl(file.tsx, 5, 31))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>l1 : Symbol(l1, Decl(file.tsx, 6, 26))
|
||||
>data : Symbol(data, Decl(file.tsx, 6, 31))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
// OK
|
||||
const c1 = <OneThing yxx='ok' />
|
||||
>c1 : Symbol(c1, Decl(file.tsx, 8, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 8, 20))
|
||||
>c1 : Symbol(c1, Decl(file.tsx, 9, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 9, 20))
|
||||
|
||||
const c2 = <OneThing yy={100} yy1="hello"/>
|
||||
>c2 : Symbol(c2, Decl(file.tsx, 9, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 9, 20))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 9, 29))
|
||||
>c2 : Symbol(c2, Decl(file.tsx, 10, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 10, 20))
|
||||
>yy1 : Symbol(yy1, Decl(file.tsx, 10, 29))
|
||||
|
||||
const c3 = <OneThing yxx="hello" ignore-prop />
|
||||
>c3 : Symbol(c3, Decl(file.tsx, 10, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 10, 20))
|
||||
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 10, 32))
|
||||
>c3 : Symbol(c3, Decl(file.tsx, 11, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>yxx : Symbol(yxx, Decl(file.tsx, 11, 20))
|
||||
>ignore-prop : Symbol(ignore-prop, Decl(file.tsx, 11, 32))
|
||||
|
||||
const c4 = <OneThing data="hello" data-prop />
|
||||
>c4 : Symbol(c4, Decl(file.tsx, 11, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 69), Decl(file.tsx, 4, 83))
|
||||
>data : Symbol(data, Decl(file.tsx, 11, 20))
|
||||
>data-prop : Symbol(data-prop, Decl(file.tsx, 11, 33))
|
||||
>c4 : Symbol(c4, Decl(file.tsx, 12, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>data : Symbol(data, Decl(file.tsx, 12, 20))
|
||||
>data-prop : Symbol(data-prop, Decl(file.tsx, 12, 33))
|
||||
|
||||
const c5 = <OneThing yxx1='ok'>Hello</OneThing>
|
||||
>c5 : Symbol(c5, Decl(file.tsx, 13, 5))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
>yxx1 : Symbol(yxx1, Decl(file.tsx, 13, 20))
|
||||
>OneThing : Symbol(OneThing, Decl(file.tsx, 0, 31), Decl(file.tsx, 2, 57), Decl(file.tsx, 3, 76), Decl(file.tsx, 4, 69), Decl(file.tsx, 5, 83))
|
||||
|
||||
|
||||
declare function TestingOneThing({y1: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>y1 : Symbol(y1)
|
||||
>string : Symbol(string, Decl(file.tsx, 13, 34))
|
||||
>string : Symbol(string, Decl(file.tsx, 16, 34))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>j : Symbol(j, Decl(file.tsx, 14, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 14, 58))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>j : Symbol(j, Decl(file.tsx, 17, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 17, 58))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function TestingOneThing(n: {yy: number, direction?: number}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 15, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 15, 37))
|
||||
>direction : Symbol(direction, Decl(file.tsx, 15, 48))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 18, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 18, 37))
|
||||
>direction : Symbol(direction, Decl(file.tsx, 18, 48))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function TestingOneThing(n: {yy: string, name: string}): JSX.Element;
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 16, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 16, 37))
|
||||
>name : Symbol(name, Decl(file.tsx, 16, 48))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>n : Symbol(n, Decl(file.tsx, 19, 33))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 19, 37))
|
||||
>name : Symbol(name, Decl(file.tsx, 19, 48))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
// OK
|
||||
const d1 = <TestingOneThing y1 extra-data />;
|
||||
>d1 : Symbol(d1, Decl(file.tsx, 19, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 19, 27))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 19, 30))
|
||||
>d1 : Symbol(d1, Decl(file.tsx, 22, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 22, 27))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 22, 30))
|
||||
|
||||
const d2 = <TestingOneThing extra-data="hello" />;
|
||||
>d2 : Symbol(d2, Decl(file.tsx, 20, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 20, 27))
|
||||
>d2 : Symbol(d2, Decl(file.tsx, 23, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 23, 27))
|
||||
|
||||
const d3 = <TestingOneThing extra-data="hello" yy="hihi" />;
|
||||
>d3 : Symbol(d3, Decl(file.tsx, 21, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 21, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 21, 46))
|
||||
>d3 : Symbol(d3, Decl(file.tsx, 24, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 24, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 24, 46))
|
||||
|
||||
const d4 = <TestingOneThing extra-data="hello" yy={9} direction={10} />;
|
||||
>d4 : Symbol(d4, Decl(file.tsx, 22, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 22, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 22, 46))
|
||||
>direction : Symbol(direction, Decl(file.tsx, 22, 53))
|
||||
>d4 : Symbol(d4, Decl(file.tsx, 25, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 25, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 25, 46))
|
||||
>direction : Symbol(direction, Decl(file.tsx, 25, 53))
|
||||
|
||||
const d5 = <TestingOneThing extra-data="hello" yy="hello" name="Bob" />;
|
||||
>d5 : Symbol(d5, Decl(file.tsx, 23, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 11, 46), Decl(file.tsx, 13, 60), Decl(file.tsx, 14, 86), Decl(file.tsx, 15, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 23, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 23, 46))
|
||||
>name : Symbol(name, Decl(file.tsx, 23, 57))
|
||||
>d5 : Symbol(d5, Decl(file.tsx, 26, 5))
|
||||
>TestingOneThing : Symbol(TestingOneThing, Decl(file.tsx, 13, 47), Decl(file.tsx, 16, 60), Decl(file.tsx, 17, 86), Decl(file.tsx, 18, 83))
|
||||
>extra-data : Symbol(extra-data, Decl(file.tsx, 26, 27))
|
||||
>yy : Symbol(yy, Decl(file.tsx, 26, 46))
|
||||
>name : Symbol(name, Decl(file.tsx, 26, 57))
|
||||
|
||||
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>a : Symbol(a, Decl(file.tsx, 26, 33))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 26, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 26, 49))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>a : Symbol(a, Decl(file.tsx, 29, 33))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 29, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 29, 49))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>a : Symbol(a, Decl(file.tsx, 27, 33))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 27, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 27, 49))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 27, 62))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>a : Symbol(a, Decl(file.tsx, 30, 33))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 30, 37))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 30, 49))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 30, 62))
|
||||
>JSX : Symbol(JSX, Decl(react.d.ts, 2352, 1))
|
||||
>Element : Symbol(JSX.Element, Decl(react.d.ts, 2355, 27))
|
||||
|
||||
// OK
|
||||
const e1 = <TestingOptional />
|
||||
>e1 : Symbol(e1, Decl(file.tsx, 30, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>e1 : Symbol(e1, Decl(file.tsx, 33, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
|
||||
const e2 = <TestingOptional extra-prop/>
|
||||
>e2 : Symbol(e2, Decl(file.tsx, 31, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>extra-prop : Symbol(extra-prop, Decl(file.tsx, 31, 27))
|
||||
>e2 : Symbol(e2, Decl(file.tsx, 34, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>extra-prop : Symbol(extra-prop, Decl(file.tsx, 34, 27))
|
||||
|
||||
const e3 = <TestingOptional y1="hello"/>
|
||||
>e3 : Symbol(e3, Decl(file.tsx, 32, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 32, 27))
|
||||
>e3 : Symbol(e3, Decl(file.tsx, 35, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 35, 27))
|
||||
|
||||
const e4 = <TestingOptional y1="hello" y2={1000} />
|
||||
>e4 : Symbol(e4, Decl(file.tsx, 33, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 33, 27))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 33, 38))
|
||||
>e4 : Symbol(e4, Decl(file.tsx, 36, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 36, 27))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 36, 38))
|
||||
|
||||
const e5 = <TestingOptional y1 y3/>
|
||||
>e5 : Symbol(e5, Decl(file.tsx, 34, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 34, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 34, 30))
|
||||
>e5 : Symbol(e5, Decl(file.tsx, 37, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 37, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 37, 30))
|
||||
|
||||
const e6 = <TestingOptional y1 y3 y2={10} />
|
||||
>e6 : Symbol(e6, Decl(file.tsx, 35, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 23, 72), Decl(file.tsx, 26, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 35, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 35, 30))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 35, 33))
|
||||
>e6 : Symbol(e6, Decl(file.tsx, 38, 5))
|
||||
>TestingOptional : Symbol(TestingOptional, Decl(file.tsx, 26, 72), Decl(file.tsx, 29, 77))
|
||||
>y1 : Symbol(y1, Decl(file.tsx, 38, 27))
|
||||
>y3 : Symbol(y3, Decl(file.tsx, 38, 30))
|
||||
>y2 : Symbol(y2, Decl(file.tsx, 38, 33))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,14 +3,22 @@ import React = require('react')
|
|||
>React : typeof React
|
||||
|
||||
declare function OneThing(k: {yxx: string}): JSX.Element;
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>k : { yxx: string; }
|
||||
>yxx : string
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
|
||||
declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>k : { yxx1: string; children: string; }
|
||||
>yxx1 : string
|
||||
>children : string
|
||||
>JSX : any
|
||||
>Element : JSX.Element
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>l : { yy: number; yy1: string; }
|
||||
>yy : number
|
||||
>yy1 : string
|
||||
|
@ -18,7 +26,7 @@ declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
|||
>Element : JSX.Element
|
||||
|
||||
declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>l : { yy: number; yy1: string; yy2: boolean; }
|
||||
>yy : number
|
||||
>yy1 : string
|
||||
|
@ -27,7 +35,7 @@ declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Eleme
|
|||
>Element : JSX.Element
|
||||
|
||||
declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>l1 : { data: string; "data-prop": boolean; }
|
||||
>data : string
|
||||
>JSX : any
|
||||
|
@ -37,13 +45,13 @@ declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element
|
|||
const c1 = <OneThing yxx='ok' />
|
||||
>c1 : JSX.Element
|
||||
><OneThing yxx='ok' /> : JSX.Element
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>yxx : string
|
||||
|
||||
const c2 = <OneThing yy={100} yy1="hello"/>
|
||||
>c2 : JSX.Element
|
||||
><OneThing yy={100} yy1="hello"/> : JSX.Element
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>yy : number
|
||||
>100 : 100
|
||||
>yy1 : string
|
||||
|
@ -51,17 +59,25 @@ const c2 = <OneThing yy={100} yy1="hello"/>
|
|||
const c3 = <OneThing yxx="hello" ignore-prop />
|
||||
>c3 : JSX.Element
|
||||
><OneThing yxx="hello" ignore-prop /> : JSX.Element
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>yxx : string
|
||||
>ignore-prop : true
|
||||
|
||||
const c4 = <OneThing data="hello" data-prop />
|
||||
>c4 : JSX.Element
|
||||
><OneThing data="hello" data-prop /> : JSX.Element
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>data : string
|
||||
>data-prop : true
|
||||
|
||||
const c5 = <OneThing yxx1='ok'>Hello</OneThing>
|
||||
>c5 : JSX.Element
|
||||
><OneThing yxx1='ok'>Hello</OneThing> : JSX.Element
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
>yxx1 : string
|
||||
>OneThing : { (k: { yxx: string; }): JSX.Element; (k: { yxx1: string; children: string; }): JSX.Element; (l: { yy: number; yy1: string; }): JSX.Element; (l: { yy: number; yy1: string; yy2: boolean; }): JSX.Element; (l1: { data: string; "data-prop": boolean; }): JSX.Element; }
|
||||
|
||||
|
||||
declare function TestingOneThing({y1: string}): JSX.Element;
|
||||
>TestingOneThing : { ({y1: string}: { y1: any; }): JSX.Element; (j: { "extra-data": string; yy?: string; }): JSX.Element; (n: { yy: number; direction?: number; }): JSX.Element; (n: { yy: string; name: string; }): JSX.Element; }
|
||||
>y1 : any
|
||||
|
|
|
@ -22,17 +22,23 @@ tests/cases/conformance/jsx/file.tsx(26,29): error TS2322: Type '{ yy: "hello";
|
|||
Type '{ yy: "hello"; direction: "left"; }' is not assignable to type '{ yy: string; direction?: number; }'.
|
||||
Types of property 'direction' are incompatible.
|
||||
Type '"left"' is not assignable to type 'number'.
|
||||
tests/cases/conformance/jsx/file.tsx(32,29): error TS2322: Type '{ y1: true; y3: "hello"; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,29): error TS2322: Type '{ y1: true; y3: "hello"; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Type '{ y1: true; y3: "hello"; }' is not assignable to type '{ y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Types of property 'y3' are incompatible.
|
||||
Type '"hello"' is not assignable to type 'boolean'.
|
||||
tests/cases/conformance/jsx/file.tsx(33,29): error TS2322: Type '{ y1: "hello"; y2: 1000; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
tests/cases/conformance/jsx/file.tsx(34,29): error TS2322: Type '{ y1: "hello"; y2: 1000; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
Type '{ y1: "hello"; y2: 1000; y3: true; }' 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'.
|
||||
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'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/jsx/file.tsx (10 errors) ====
|
||||
==== tests/cases/conformance/jsx/file.tsx (12 errors) ====
|
||||
import React = require('react')
|
||||
declare function OneThing(): JSX.Element;
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
|
@ -93,6 +99,7 @@ tests/cases/conformance/jsx/file.tsx(33,29): error TS2322: Type '{ y1: "hello";
|
|||
!!! error TS2322: Type '"left"' is not assignable to type 'number'.
|
||||
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
|
||||
|
||||
// Error
|
||||
|
@ -107,5 +114,15 @@ tests/cases/conformance/jsx/file.tsx(33,29): error TS2322: Type '{ y1: "hello";
|
|||
!!! error TS2322: Type '{ y1: "hello"; y2: 1000; y3: true; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
!!! error TS2322: Type '{ y1: "hello"; y2: 1000; y3: true; }' 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'.
|
||||
const e3 = <TestingOptional y1="hello" y2={1000} children="hi" />
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS2322: Type '{ y1: "hello"; y2: 1000; children: "hi"; }' is not assignable to type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
!!! error TS2322: Property 'children' does not exist on type 'IntrinsicAttributes & { y1: boolean; y2?: number; y3: boolean; }'.
|
||||
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'.
|
||||
|
|
@ -27,11 +27,14 @@ const d1 = <TestingOneThing extra-data />
|
|||
const d2 = <TestingOneThing yy="hello" direction="left" />
|
||||
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
|
||||
|
||||
// Error
|
||||
const e1 = <TestingOptional y1 y3="hello"/>
|
||||
const e2 = <TestingOptional y1="hello" y2={1000} y3 />
|
||||
const e3 = <TestingOptional y1="hello" y2={1000} children="hi" />
|
||||
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
|
||||
|
||||
|
||||
//// [file.jsx]
|
||||
|
@ -58,4 +61,6 @@ define(["require", "exports", "react"], function (require, exports, React) {
|
|||
// Error
|
||||
var e1 = <TestingOptional y1 y3="hello"/>;
|
||||
var e2 = <TestingOptional y1="hello" y2={1000} y3/>;
|
||||
var e3 = <TestingOptional y1="hello" y2={1000} children="hi"/>;
|
||||
var e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>;
|
||||
});
|
||||
|
|
|
@ -18,11 +18,19 @@ function Comp(p: Prop) {
|
|||
// Error: missing children
|
||||
let k = <Comp a={10} b="hi" />;
|
||||
|
||||
let k1 =
|
||||
let k0 =
|
||||
<Comp a={10} b="hi" children="Random" >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
let o = {
|
||||
children:"Random"
|
||||
}
|
||||
let k1 =
|
||||
<Comp a={10} b="hi" {...o} >
|
||||
hi hi hi!
|
||||
</Comp>;
|
||||
|
||||
// Error: incorrect type
|
||||
let k2 =
|
||||
<Comp a={10} b="hi">
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import React = require('react')
|
||||
|
||||
declare function OneThing(k: {yxx: string}): JSX.Element;
|
||||
declare function OneThing(k: {yxx1: string, children: string}): JSX.Element;
|
||||
declare function OneThing(l: {yy: number, yy1: string}): JSX.Element;
|
||||
declare function OneThing(l: {yy: number, yy1: string, yy2: boolean}): JSX.Element;
|
||||
declare function OneThing(l1: {data: string, "data-prop": boolean}): JSX.Element;
|
||||
|
@ -16,6 +17,8 @@ const c1 = <OneThing yxx='ok' />
|
|||
const c2 = <OneThing yy={100} yy1="hello"/>
|
||||
const c3 = <OneThing yxx="hello" ignore-prop />
|
||||
const c4 = <OneThing data="hello" data-prop />
|
||||
const c5 = <OneThing yxx1='ok'>Hello</OneThing>
|
||||
|
||||
|
||||
declare function TestingOneThing({y1: string}): JSX.Element;
|
||||
declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element;
|
||||
|
|
|
@ -32,8 +32,11 @@ const d1 = <TestingOneThing extra-data />
|
|||
const d2 = <TestingOneThing yy="hello" direction="left" />
|
||||
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1?: string, y2?: number, children: JSX.Element}): JSX.Element;
|
||||
declare function TestingOptional(a: {y1: boolean, y2?: number, y3: boolean}): JSX.Element;
|
||||
|
||||
// Error
|
||||
const e1 = <TestingOptional y1 y3="hello"/>
|
||||
const e2 = <TestingOptional y1="hello" y2={1000} y3 />
|
||||
const e3 = <TestingOptional y1="hello" y2={1000} children="hi" />
|
||||
const e4 = <TestingOptional y1="hello" y2={1000}>Hi</TestingOptional>
|
||||
|
|
Loading…
Reference in a new issue