From 58e2189f450b6f0dcc17f254df3b34f291425d82 Mon Sep 17 00:00:00 2001 From: Kanchalai Tanglertsampan Date: Wed, 12 Apr 2017 13:38:11 -0700 Subject: [PATCH] Add tests and update baselines --- src/compiler/scanner.ts | 2 +- .../checkJsxChildrenProperty2.errors.txt | 23 +- .../reference/checkJsxChildrenProperty2.js | 18 +- .../tsxStatelessFunctionComponentOverload1.js | 4 + ...tatelessFunctionComponentOverload1.symbols | 199 ++++++++++-------- ...xStatelessFunctionComponentOverload1.types | 32 ++- ...elessFunctionComponentOverload4.errors.txt | 23 +- .../tsxStatelessFunctionComponentOverload4.js | 5 + .../jsx/checkJsxChildrenProperty2.tsx | 10 +- ...tsxStatelessFunctionComponentOverload1.tsx | 3 + ...tsxStatelessFunctionComponentOverload4.tsx | 3 + 11 files changed, 209 insertions(+), 113 deletions(-) diff --git a/src/compiler/scanner.ts b/src/compiler/scanner.ts index 1e070686de..8f2cacd3e3 100644 --- a/src/compiler/scanner.ts +++ b/src/compiler/scanner.ts @@ -1,4 +1,4 @@ -/// +/// /// namespace ts { diff --git a/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt b/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt index d3639d6783..ecde87c6fb 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt +++ b/tests/baselines/reference/checkJsxChildrenProperty2.errors.txt @@ -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 = ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten. hi hi hi! ; + let o = { + children:"Random" + } + let k1 = + + ~~~~~~~~~~~~~~~~~~~~ +!!! error TS2708: props.children are specified twice. The attribute named 'children' will be overwritten. + hi hi hi! + ; + // Error: incorrect type let k2 = diff --git a/tests/baselines/reference/checkJsxChildrenProperty2.js b/tests/baselines/reference/checkJsxChildrenProperty2.js index 3de7333fd6..dd92bb5dba 100644 --- a/tests/baselines/reference/checkJsxChildrenProperty2.js +++ b/tests/baselines/reference/checkJsxChildrenProperty2.js @@ -14,11 +14,19 @@ function Comp(p: Prop) { // Error: missing children let k = ; -let k1 = +let k0 = hi hi hi! ; +let o = { + children:"Random" +} +let k1 = + + hi hi hi! + ; + // Error: incorrect type let k2 = @@ -53,7 +61,13 @@ function Comp(p) { } // Error: missing children var k = ; -var k1 = +var k0 = + hi hi hi! + ; +var o = { + children: "Random" +}; +var k1 = hi hi hi! ; // Error: incorrect type diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.js b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.js index 825a625eb2..09eb20c755 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.js @@ -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 = const c2 = const c3 = const c4 = +const c5 = Hello + 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 = ; var c3 = ; var c4 = ; + var c5 = Hello; // OK var d1 = ; var d2 = ; diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.symbols b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.symbols index b2de411e24..809766f59d 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.symbols +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.symbols @@ -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 = ->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 = ->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 = ->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 = ->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 = Hello +>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 = ; ->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 = ; ->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 = ; ->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 = ; ->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 = ; ->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 = ->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 = ->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 = ->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 = ->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 = ->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 = ->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)) diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.types b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.types index 22ef23bcae..8e288ebd34 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.types +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload1.types @@ -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 = >c1 : JSX.Element > : 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 = >c2 : JSX.Element > : 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 = const c3 = >c3 : JSX.Element > : 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 = >c4 : JSX.Element > : 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 = Hello +>c5 : JSX.Element +>Hello : 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 diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt index 9995610b87..8b95f86efd 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.errors.txt @@ -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 = + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +!!! 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 = Hi + ~~~~~~~~~~~~~~~~~~~~ +!!! 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'. \ No newline at end of file diff --git a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.js b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.js index a4d329409a..8da2bee37e 100644 --- a/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.js +++ b/tests/baselines/reference/tsxStatelessFunctionComponentOverload4.js @@ -27,11 +27,14 @@ const d1 = const d2 = 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 = const e2 = +const e3 = +const e4 = Hi //// [file.jsx] @@ -58,4 +61,6 @@ define(["require", "exports", "react"], function (require, exports, React) { // Error var e1 = ; var e2 = ; + var e3 = ; + var e4 = Hi; }); diff --git a/tests/cases/conformance/jsx/checkJsxChildrenProperty2.tsx b/tests/cases/conformance/jsx/checkJsxChildrenProperty2.tsx index 0c78f8f412..65bc0f50b1 100644 --- a/tests/cases/conformance/jsx/checkJsxChildrenProperty2.tsx +++ b/tests/cases/conformance/jsx/checkJsxChildrenProperty2.tsx @@ -18,11 +18,19 @@ function Comp(p: Prop) { // Error: missing children let k = ; -let k1 = +let k0 = hi hi hi! ; +let o = { + children:"Random" +} +let k1 = + + hi hi hi! + ; + // Error: incorrect type let k2 = diff --git a/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload1.tsx b/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload1.tsx index ea950d8b6d..d8897321f0 100644 --- a/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload1.tsx +++ b/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload1.tsx @@ -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 = const c2 = const c3 = const c4 = +const c5 = Hello + declare function TestingOneThing({y1: string}): JSX.Element; declare function TestingOneThing(j: {"extra-data": string, yy?: string}): JSX.Element; diff --git a/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx b/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx index 377878931b..7700fed690 100644 --- a/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx +++ b/tests/cases/conformance/jsx/tsxStatelessFunctionComponentOverload4.tsx @@ -32,8 +32,11 @@ const d1 = const d2 = 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 = const e2 = +const e3 = +const e4 = Hi