Don't error on JSX elements when JSX.Element isn't present

This commit is contained in:
Ryan Cavanaugh
2015-06-25 11:14:45 -07:00
parent 65828c4d9f
commit 8180b7d06f
26 changed files with 1126 additions and 654 deletions

View File

@@ -3800,7 +3800,7 @@ namespace ts {
function getExportedTypeFromNamespace(namespace: string, name: string): Type {
var namespaceSymbol = getGlobalSymbol(namespace, SymbolFlags.Namespace, /*diagnosticMessage*/ undefined);
var typeSymbol = namespaceSymbol && getSymbol(namespaceSymbol.exports, name, SymbolFlags.Type);
return (typeSymbol && getDeclaredTypeOfSymbol(typeSymbol)) || unknownType;
return typeSymbol && getDeclaredTypeOfSymbol(typeSymbol);
}
function getGlobalESSymbolConstructorSymbol() {
@@ -6712,7 +6712,7 @@ namespace ts {
function checkJsxSelfClosingElement(node: JsxSelfClosingElement) {
checkJsxOpeningLikeElement(node);
return jsxElementType;
return jsxElementType || anyType;
}
function tagNamesAreEquivalent(lhs: EntityName, rhs: EntityName): boolean {
@@ -6755,7 +6755,7 @@ namespace ts {
}
}
return jsxElementType;
return jsxElementType || anyType;
}
/**
@@ -7087,8 +7087,10 @@ namespace ts {
error(errorNode, Diagnostics.Cannot_use_JSX_unless_the_jsx_flag_is_provided);
}
if (jsxElementType === unknownType) {
error(errorNode, Diagnostics.The_global_type_JSX_Element_must_exist_when_using_JSX);
if (jsxElementType === undefined) {
if(compilerOptions.noImplicitAny) {
error(errorNode, Diagnostics.JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist);
}
}
}

View File

@@ -391,7 +391,7 @@ namespace ts {
Base_constructors_must_all_have_the_same_return_type: { code: 2510, category: DiagnosticCategory.Error, key: "Base constructors must all have the same return type." },
JSX_element_attributes_type_0_must_be_an_object_type: { code: 2600, category: DiagnosticCategory.Error, key: "JSX element attributes type '{0}' must be an object type." },
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: { code: 2601, category: DiagnosticCategory.Error, key: "The return type of a JSX element constructor must return an object type." },
The_global_type_JSX_Element_must_exist_when_using_JSX: { code: 2602, category: DiagnosticCategory.Error, key: "The global type 'JSX.Element' must exist when using JSX." },
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: { code: 2602, category: DiagnosticCategory.Error, key: "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist." },
Property_0_in_type_1_is_not_assignable_to_type_2: { code: 2603, category: DiagnosticCategory.Error, key: "Property '{0}' in type '{1}' is not assignable to type '{2}'" },
JSX_element_type_0_does_not_have_any_construct_or_call_signatures: { code: 2604, category: DiagnosticCategory.Error, key: "JSX element type '{0}' does not have any construct or call signatures." },
JSX_element_type_0_is_not_a_constructor_function_for_JSX_elements: { code: 2605, category: DiagnosticCategory.Error, key: "JSX element type '{0}' is not a constructor function for JSX elements." },

View File

@@ -1554,7 +1554,7 @@
"category": "Error",
"code": 2601
},
"The global type 'JSX.Element' must exist when using JSX.": {
"JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.": {
"category": "Error",
"code": 2602
},

View File

@@ -1,34 +1,14 @@
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,13): error TS2304: Cannot find name 'test'.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,17): error TS1005: '}' expected.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(7,19): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(9,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(9,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(11,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(11,17): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(11,32): error TS1005: '}' expected.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(13,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(13,16): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(13,36): error TS1005: '}' expected.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,16): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,31): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(15,45): error TS1005: '}' expected.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(17,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(17,23): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,7): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,12): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,34): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,39): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,53): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(19,58): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS1005: ':' expected.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expected corresponding JSX closing tag for 'any'.
tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expected corresponding JSX closing tag for 'foo'.
==== tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx (28 errors) ====
==== tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx (8 errors) ====
declare var createElement: any;
@@ -36,79 +16,32 @@ tests/cases/conformance/jsx/jsxAndTypeAssertion.tsx(22,1): error TS17002: Expect
var x: any;
x = <any> { test: <any></any> };
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~
!!! error TS2304: Cannot find name 'test'.
~
!!! error TS1005: '}' expected.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
x = <any><any></any>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
x = <foo>hello {<foo>{}} </foo>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '}' expected.
x = <foo test={<foo>{}}>hello</foo>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '}' expected.
x = <foo test={<foo>{}}>hello{<foo>{}}</foo>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '}' expected.
x = <foo>x</foo>, x = <foo/>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<foo>{<foo><foo>{/foo/.test(x) ? <foo><foo></foo> : <foo><foo></foo>}</foo>}</foo>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
!!! error TS1005: ':' expected.
!!! error TS17002: Expected corresponding JSX closing tag for 'any'.

View File

@@ -1,131 +0,0 @@
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(9,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(15,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(17,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(18,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(21,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(23,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(29,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(29,11): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(29,19): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(31,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(33,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(35,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(37,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(37,6): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,17): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(39,29): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(41,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(43,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(45,2): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(47,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(49,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(51,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx(53,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
==== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx (24 errors) ====
declare var React: any;
declare var 日本語;
declare var AbC_def;
declare var LeftRight;
declare var x;
declare var a;
declare var props;
<a />;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
//<n:a n:v />; Namespace unsuported
//<a n:foo="bar"> {value} <b><c /></b></a>; Namespace unsuported
<a b={" "} c=" " d="&amp;" e="id=1&group=2" f="&#123456789" g="&#123*;" h="&#x;" />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a b="&notanentity;" />;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a
~~
/>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<日本語></日本語>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<AbC_def
~~~~~~~~
test="&#x0026;&#38;">
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
bar
baz
</AbC_def>;
<a b={x ? <c /> : <d />} />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a>{}</a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a>{/* this is a comment */}</a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div>@test content</div>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div><br />7x invalid-js-identifier</div>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a.b></a.b>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a.b.c></a.b.c>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
(<div />) < x;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div {...props} />;
~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div {...props} post="attribute" />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div pre="leading" pre2="attribute" {...props}></div>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a> </a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.

View File

@@ -0,0 +1,92 @@
=== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx ===
declare var React: any;
>React : Symbol(React, Decl(jsxEsprimaFbTestSuite.tsx, 0, 11))
declare var 日本語;
>日本語 : Symbol(日本語, Decl(jsxEsprimaFbTestSuite.tsx, 1, 11))
declare var AbC_def;
>AbC_def : Symbol(AbC_def, Decl(jsxEsprimaFbTestSuite.tsx, 2, 11))
declare var LeftRight;
>LeftRight : Symbol(LeftRight, Decl(jsxEsprimaFbTestSuite.tsx, 3, 11))
declare var x;
>x : Symbol(x, Decl(jsxEsprimaFbTestSuite.tsx, 4, 11))
declare var a;
>a : Symbol(a, Decl(jsxEsprimaFbTestSuite.tsx, 5, 11))
declare var props;
>props : Symbol(props, Decl(jsxEsprimaFbTestSuite.tsx, 6, 11))
<a />;
//<n:a n:v />; Namespace unsuported
//<a n:foo="bar"> {value} <b><c /></b></a>; Namespace unsuported
<a b={" "} c=" " d="&amp;" e="id=1&group=2" f="&#123456789" g="&#123*;" h="&#x;" />;
>b : Symbol(unknown)
>c : Symbol(unknown)
>d : Symbol(unknown)
>e : Symbol(unknown)
>f : Symbol(unknown)
>g : Symbol(unknown)
>h : Symbol(unknown)
<a b="&notanentity;" />;
>b : Symbol(unknown)
<a
/>;
<日本語></日本語>;
<AbC_def
>AbC_def : Symbol(AbC_def, Decl(jsxEsprimaFbTestSuite.tsx, 2, 11))
test="&#x0026;&#38;">
>test : Symbol(unknown)
bar
baz
</AbC_def>;
<a b={x ? <c /> : <d />} />;
>b : Symbol(unknown)
>x : Symbol(x, Decl(jsxEsprimaFbTestSuite.tsx, 4, 11))
<a>{}</a>;
<a>{/* this is a comment */}</a>;
<div>@test content</div>;
<div><br />7x invalid-js-identifier</div>;
<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />;
>LeftRight : Symbol(LeftRight, Decl(jsxEsprimaFbTestSuite.tsx, 3, 11))
>left : Symbol(unknown)
>right : Symbol(unknown)
<a.b></a.b>;
>b : Symbol(unknown)
<a.b.c></a.b.c>;
>c : Symbol(unknown)
(<div />) < x;
>x : Symbol(x, Decl(jsxEsprimaFbTestSuite.tsx, 4, 11))
<div {...props} />;
<div {...props} post="attribute" />;
>post : Symbol(unknown)
<div pre="leading" pre2="attribute" {...props}></div>;
>pre : Symbol(unknown)
>pre2 : Symbol(unknown)
<a> </a>;

View File

@@ -0,0 +1,160 @@
=== tests/cases/conformance/jsx/jsxEsprimaFbTestSuite.tsx ===
declare var React: any;
>React : any
declare var 日本語;
>日本語 : any
declare var AbC_def;
>AbC_def : any
declare var LeftRight;
>LeftRight : any
declare var x;
>x : any
declare var a;
>a : any
declare var props;
>props : any
<a />;
><a /> : any
>a : any
//<n:a n:v />; Namespace unsuported
//<a n:foo="bar"> {value} <b><c /></b></a>; Namespace unsuported
<a b={" "} c=" " d="&amp;" e="id=1&group=2" f="&#123456789" g="&#123*;" h="&#x;" />;
><a b={" "} c=" " d="&amp;" e="id=1&group=2" f="&#123456789" g="&#123*;" h="&#x;" /> : any
>a : any
>b : any
>c : any
>d : any
>e : any
>f : any
>g : any
>h : any
<a b="&notanentity;" />;
><a b="&notanentity;" /> : any
>a : any
>b : any
<a
><a/> : any
>a : any
/>;
<日本語></日本語>;
><日本語></日本語> : any
>日本語 : any
>日本語 : any
<AbC_def
><AbC_def test="&#x0026;&#38;">barbaz</AbC_def> : any
>AbC_def : any
test="&#x0026;&#38;">
>test : any
bar
baz
</AbC_def>;
>AbC_def : any
<a b={x ? <c /> : <d />} />;
><a b={x ? <c /> : <d />} /> : any
>a : any
>b : any
>x ? <c /> : <d /> : any
>x : any
><c /> : any
>c : any
><d /> : any
>d : any
<a>{}</a>;
><a>{}</a> : any
>a : any
>a : any
<a>{/* this is a comment */}</a>;
><a>{/* this is a comment */}</a> : any
>a : any
>a : any
<div>@test content</div>;
><div>@test content</div> : any
>div : any
>div : any
<div><br />7x invalid-js-identifier</div>;
><div><br />7x invalid-js-identifier</div> : any
>div : any
><br /> : any
>br : any
>div : any
<LeftRight left=<a /> right=<b>monkeys /> gorillas</b> />;
><LeftRight left=<a /> right=<b>monkeys /> gorillas</b> /> : any
>LeftRight : any
>left : any
><a /> : any
>a : any
>right : any
><b>monkeys /> gorillas</b> : any
>b : any
>b : any
<a.b></a.b>;
><a.b></a.b> : any
>a : any
>b : any
>a : any
>b : any
<a.b.c></a.b.c>;
><a.b.c></a.b.c> : any
>a : any
>b : any
>c : any
>a : any
>b : any
>c : any
(<div />) < x;
>(<div />) < x : boolean
>(<div />) : any
><div /> : any
>div : any
>x : any
<div {...props} />;
><div {...props} /> : any
>div : any
>props : any
<div {...props} post="attribute" />;
><div {...props} post="attribute" /> : any
>div : any
>props : any
>post : any
<div pre="leading" pre2="attribute" {...props}></div>;
><div pre="leading" pre2="attribute" {...props}></div> : any
>div : any
>pre : any
>pre2 : any
>props : any
>div : any
<a> </a>;
><a> </a> : any
>a : any
>a : any

View File

@@ -1,14 +1,12 @@
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(3,1): error TS1128: Declaration or statement expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(3,3): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(3,4): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(4,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(4,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,1): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,2): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,3): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,6): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,7): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,6): error TS1005: '{' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,6): error TS2304: Cannot find name 'd'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,9): error TS1109: Expression expected.
@@ -16,9 +14,7 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,10): error TS1109:
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(7,1): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(7,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(7,4): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(8,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(8,4): error TS17002: Expected corresponding JSX closing tag for 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(9,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(9,13): error TS1002: Unterminated string literal.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,1): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,2): error TS2304: Cannot find name 'a'.
@@ -27,19 +23,16 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,4): error TS2304:
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,6): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,8): error TS2304: Cannot find name 'b'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,10): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,5): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,11): error TS1005: '>' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,12): error TS2304: Cannot find name 'b'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(11,16): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,5): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,13): error TS1005: '>' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,14): error TS2304: Cannot find name 'c'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(12,16): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(13,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(13,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(13,8): error TS17002: Expected corresponding JSX closing tag for 'a.b.c'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,1): error TS1109: Expression expected.
@@ -48,59 +41,36 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,5): error TS1109:
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,7): error TS1128: Declaration or statement expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,8): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,10): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,2): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,4): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(15,9): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,4): error TS2304: Cannot find name 'foo'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,9): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,11): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,13): error TS2304: Cannot find name 'foo'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(16,18): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,11): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,13): error TS2304: Cannot find name 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(17,22): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(18,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(18,4): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(19,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(20,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(20,23): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(21,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(21,50): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(22,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(22,10): error TS1005: '}' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(23,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(23,20): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(24,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(24,15): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,7): error TS1005: '...' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(25,7): error TS2304: Cannot find name 'props'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,17): error TS1005: '>' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(27,18): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,10): error TS2304: Cannot find name 'props'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,28): error TS1005: '>' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(28,29): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(30,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(31,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(32,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(32,6): error TS1005: '{' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,6): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(33,7): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(34,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,4): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002: Expected corresponding JSX closing tag for 'a'.
==== tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx (100 errors) ====
==== tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx (70 errors) ====
declare var React: any;
</>;
@@ -111,8 +81,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a: />;
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<:a />;
@@ -127,8 +95,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a b=d />;
~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '{' expected.
~
@@ -145,13 +111,9 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a></b>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~
!!! error TS17002: Expected corresponding JSX closing tag for 'a'.
<a foo="bar;
~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
!!! error TS1002: Unterminated string literal.
<a:b></b>;
@@ -170,8 +132,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a:b.c></a:b.c>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~
@@ -183,8 +143,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a.b:c></a.b:c>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2304: Cannot find name 'a'.
~
@@ -196,8 +154,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a.b.c></a>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2304: Cannot find name 'a'.
~~~~
@@ -216,8 +172,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a.></a.>;
~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2304: Cannot find name 'a'.
~
@@ -225,8 +179,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1003: Identifier expected.
<a[foo]></a[foo]>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~~~
@@ -240,8 +192,6 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a['foo']></a['foo']>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~~
@@ -251,56 +201,30 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
~
!!! error TS1109: Expression expected.
<a><a />;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a b={}>;
~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
var x = <div>one</div><div>two</div>;;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
var x = <div>one</div> /* intervening comment */ <div>two</div>;;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a>{"str";}</a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '}' expected.
<span className="a", id="b" />;
~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<div className"app">;
~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS1003: Identifier expected.
<div {props} />;
~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS1005: '...' expected.
~~~~~
!!! error TS2304: Cannot find name 'props'.
<div>stuff</div {...props}>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '>' expected.
~~~
!!! error TS1109: Expression expected.
<div {...props}>stuff</div {...props}>;
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~
!!! error TS2304: Cannot find name 'props'.
~
@@ -309,29 +233,15 @@ tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002
!!! error TS1109: Expression expected.
<a>></a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a> ></a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a b=}>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '{' expected.
<a b=<}>;
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<a>}</a>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<a .../*hai*/asdf/>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~
!!! error TS1003: Identifier expected.

View File

@@ -1,246 +0,0 @@
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(15,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(17,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(21,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(22,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(22,8): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(23,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(23,19): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(24,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(28,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(32,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(33,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(37,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(55,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(58,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(62,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(69,3): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(73,5): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(79,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(81,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(83,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(85,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(87,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(89,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(91,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(94,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(97,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(99,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(101,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(103,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(105,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(107,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(109,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(112,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(112,38): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxReactTestSuite.tsx(114,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
==== tests/cases/conformance/jsx/jsxReactTestSuite.tsx (35 errors) ====
declare var React: any;
declare var Component:any;
declare var Composite:any;
declare var Composite2:any;
declare var Child:any;
declare var Namespace:any;
declare var foo: any;
declare var bar: any;
declare var y:any;
declare var x:any;
declare var z:any;
declare var hasOwnProperty:any;
<div>text</div>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div>
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
{this.props.children}
</div>;
<div>
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div><br /></div>
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component>{foo}<br />{bar}</Component>
~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<br />
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
</div>;
<Composite>
~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
{this.props.children}
</Composite>;
<Composite>
~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Composite2 />
~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
</Composite>;
var x =
<div
~~~~
attr1={
~~~~~~~~~~~
"foo" + "bar"
~~~~~~~~~~~~~~~~~~~
}
~~~~~
attr2={
~~~~~~~~~~~
"foo" + "bar" +
~~~~~~~~~~~~~~~~~~~~~
~~~~~~
"baz" + "bug"
~~~~~~~~~~~~~~~~~~~
}
~~~~~
attr3={
~~~~~~~~~~~
"foo" + "bar" +
~~~~~~~~~~~~~~~~~~~~~
"baz" + "bug"
~~~~~~~~~~~~~~~~~~~
// Extra line here.
~~~~~~~~~~~~~~~~~~~~~~~~~
}
~~~~~
attr4="baz">
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
</div>;
(
<div>
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
{/* A comment at the beginning */}
{/* A second comment at the beginning */}
<span>
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
{/* A nested comment */}
</span>
{/* A sandwiched comment */}
<br />
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
{/* A comment at the end */}
{/* A second comment at the end */}
</div>
);
(
<div
~~~~
/* a multi-line
~~~~~~~~~~~~~~~~~~~
comment */
~~~~~~~~~~~~~~~~~
attr1="foo">
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<span // a double-slash comment
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
attr2="bar"
~~~~~~~~~~~~~~~~~
/>
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
</div>
);
<div>&nbsp;</div>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<div>&nbsp; </div>;
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<hasOwnProperty>testing</hasOwnProperty>;
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component constructor="foo" />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Namespace.Component />;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Namespace.DeepNamespace.Component />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component { ... x } y
~~~~~~~~~~~~~~~~~~~~~~
={2 } z />;
~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component
~~~~~~~~~~
{...this.props} sound="moo" />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<font-face />;
~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component x={y} />;
~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<x-component />;
~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component {...x} />;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component { ...x } y={2} />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component { ... x } y={2} z />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component x={1} {...y} />;
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.

View File

@@ -0,0 +1,194 @@
=== tests/cases/conformance/jsx/jsxReactTestSuite.tsx ===
declare var React: any;
>React : Symbol(React, Decl(jsxReactTestSuite.tsx, 1, 11))
declare var Component:any;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
declare var Composite:any;
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
declare var Composite2:any;
>Composite2 : Symbol(Composite2, Decl(jsxReactTestSuite.tsx, 4, 11))
declare var Child:any;
>Child : Symbol(Child, Decl(jsxReactTestSuite.tsx, 5, 11))
declare var Namespace:any;
>Namespace : Symbol(Namespace, Decl(jsxReactTestSuite.tsx, 6, 11))
declare var foo: any;
>foo : Symbol(foo, Decl(jsxReactTestSuite.tsx, 7, 11))
declare var bar: any;
>bar : Symbol(bar, Decl(jsxReactTestSuite.tsx, 8, 11))
declare var y:any;
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 9, 11))
declare var x:any;
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
declare var z:any;
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
declare var hasOwnProperty:any;
>hasOwnProperty : Symbol(hasOwnProperty, Decl(jsxReactTestSuite.tsx, 12, 11))
<div>text</div>;
<div>
{this.props.children}
</div>;
<div>
<div><br /></div>
<Component>{foo}<br />{bar}</Component>
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
<br />
</div>;
<Composite>
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
{this.props.children}
</Composite>;
<Composite>
>Composite : Symbol(Composite, Decl(jsxReactTestSuite.tsx, 3, 11))
<Composite2 />
>Composite2 : Symbol(Composite2, Decl(jsxReactTestSuite.tsx, 4, 11))
</Composite>;
var x =
>x : Symbol(x, Decl(jsxReactTestSuite.tsx, 10, 11), Decl(jsxReactTestSuite.tsx, 35, 3))
<div
attr1={
>attr1 : Symbol(unknown)
"foo" + "bar"
}
attr2={
>attr2 : Symbol(unknown)
"foo" + "bar" +
"baz" + "bug"
}
attr3={
>attr3 : Symbol(unknown)
"foo" + "bar" +
"baz" + "bug"
// Extra line here.
}
attr4="baz">
>attr4 : Symbol(unknown)
</div>;
(
<div>
{/* A comment at the beginning */}
{/* A second comment at the beginning */}
<span>
{/* A nested comment */}
</span>
{/* A sandwiched comment */}
<br />
{/* A comment at the end */}
{/* A second comment at the end */}
</div>
);
(
<div
/* a multi-line
comment */
attr1="foo">
>attr1 : Symbol(unknown)
<span // a double-slash comment
attr2="bar"
>attr2 : Symbol(unknown)
/>
</div>
);
<div>&nbsp;</div>;
<div>&nbsp; </div>;
<hasOwnProperty>testing</hasOwnProperty>;
<Component constructor="foo" />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>constructor : Symbol(unknown)
<Namespace.Component />;
>Component : Symbol(unknown)
<Namespace.DeepNamespace.Component />;
>Component : Symbol(unknown)
<Component { ... x } y
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>y : Symbol(unknown)
={2 } z />;
>z : Symbol(unknown)
<Component
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
{...this.props} sound="moo" />;
>sound : Symbol(unknown)
<font-face />;
<Component x={y} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
<x-component />;
<Component {...x} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
<Component { ...x } y={2} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>y : Symbol(unknown)
<Component { ... x } y={2} z />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>y : Symbol(unknown)
>z : Symbol(unknown)
<Component x={1} {...y} />;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>y : Symbol(unknown)
>Child : Symbol(Child, Decl(jsxReactTestSuite.tsx, 5, 11))
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
>Component : Symbol(Component, Decl(jsxReactTestSuite.tsx, 2, 11))
>x : Symbol(unknown)
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>y : Symbol(y, Decl(jsxReactTestSuite.tsx, 113, 27))
>z : Symbol(z, Decl(jsxReactTestSuite.tsx, 11, 11))
>z : Symbol(unknown)

View File

@@ -0,0 +1,332 @@
=== tests/cases/conformance/jsx/jsxReactTestSuite.tsx ===
declare var React: any;
>React : any
declare var Component:any;
>Component : any
declare var Composite:any;
>Composite : any
declare var Composite2:any;
>Composite2 : any
declare var Child:any;
>Child : any
declare var Namespace:any;
>Namespace : any
declare var foo: any;
>foo : any
declare var bar: any;
>bar : any
declare var y:any;
>y : any
declare var x:any;
>x : any
declare var z:any;
>z : any
declare var hasOwnProperty:any;
>hasOwnProperty : any
<div>text</div>;
><div>text</div> : any
>div : any
>div : any
<div>
><div> {this.props.children}</div> : any
>div : any
{this.props.children}
>this.props.children : any
>this.props : any
>this : any
>props : any
>children : any
</div>;
>div : any
<div>
><div> <div><br /></div> <Component>{foo}<br />{bar}</Component> <br /></div> : any
>div : any
<div><br /></div>
><div><br /></div> : any
>div : any
><br /> : any
>br : any
>div : any
<Component>{foo}<br />{bar}</Component>
><Component>{foo}<br />{bar}</Component> : any
>Component : any
>foo : any
><br /> : any
>br : any
>bar : any
>Component : any
<br />
><br /> : any
>br : any
</div>;
>div : any
<Composite>
><Composite> {this.props.children}</Composite> : any
>Composite : any
{this.props.children}
>this.props.children : any
>this.props : any
>this : any
>props : any
>children : any
</Composite>;
>Composite : any
<Composite>
><Composite> <Composite2 /></Composite> : any
>Composite : any
<Composite2 />
><Composite2 /> : any
>Composite2 : any
</Composite>;
>Composite : any
var x =
>x : any
<div
><div attr1={ "foo" + "bar" } attr2={ "foo" + "bar" + "baz" + "bug" } attr3={ "foo" + "bar" + "baz" + "bug" // Extra line here. } attr4="baz"> </div> : any
>div : any
attr1={
>attr1 : any
"foo" + "bar"
>"foo" + "bar" : string
>"foo" : string
>"bar" : string
}
attr2={
>attr2 : any
"foo" + "bar" +
>"foo" + "bar" + "baz" + "bug" : string
>"foo" + "bar" + "baz" : string
>"foo" + "bar" : string
>"foo" : string
>"bar" : string
"baz" + "bug"
>"baz" : string
>"bug" : string
}
attr3={
>attr3 : any
"foo" + "bar" +
>"foo" + "bar" + "baz" + "bug" : string
>"foo" + "bar" + "baz" : string
>"foo" + "bar" : string
>"foo" : string
>"bar" : string
"baz" + "bug"
>"baz" : string
>"bug" : string
// Extra line here.
}
attr4="baz">
>attr4 : any
</div>;
>div : any
(
>( <div> {/* A comment at the beginning */} {/* A second comment at the beginning */} <span> {/* A nested comment */} </span> {/* A sandwiched comment */} <br /> {/* A comment at the end */} {/* A second comment at the end */} </div>) : any
<div>
><div> {/* A comment at the beginning */} {/* A second comment at the beginning */} <span> {/* A nested comment */} </span> {/* A sandwiched comment */} <br /> {/* A comment at the end */} {/* A second comment at the end */} </div> : any
>div : any
{/* A comment at the beginning */}
{/* A second comment at the beginning */}
<span>
><span> {/* A nested comment */} </span> : any
>span : any
{/* A nested comment */}
</span>
>span : any
{/* A sandwiched comment */}
<br />
><br /> : any
>br : any
{/* A comment at the end */}
{/* A second comment at the end */}
</div>
>div : any
);
(
>( <div /* a multi-line comment */ attr1="foo"> <span // a double-slash comment attr2="bar" /> </div>) : any
<div
><div /* a multi-line comment */ attr1="foo"> <span // a double-slash comment attr2="bar" /> </div> : any
>div : any
/* a multi-line
comment */
attr1="foo">
>attr1 : any
<span // a double-slash comment
><span // a double-slash comment attr2="bar" /> : any
>span : any
attr2="bar"
>attr2 : any
/>
</div>
>div : any
);
<div>&nbsp;</div>;
><div>&nbsp;</div> : any
>div : any
>div : any
<div>&nbsp; </div>;
><div>&nbsp; </div> : any
>div : any
>div : any
<hasOwnProperty>testing</hasOwnProperty>;
><hasOwnProperty>testing</hasOwnProperty> : any
>hasOwnProperty : any
>hasOwnProperty : any
<Component constructor="foo" />;
><Component constructor="foo" /> : any
>Component : any
>constructor : any
<Namespace.Component />;
><Namespace.Component /> : any
>Namespace : any
>Component : any
<Namespace.DeepNamespace.Component />;
><Namespace.DeepNamespace.Component /> : any
>Namespace : any
>DeepNamespace : any
>Component : any
<Component { ... x } y
><Component { ... x } y={2 } z /> : any
>Component : any
>x : any
>y : any
={2 } z />;
>z : any
<Component
><Component {...this.props} sound="moo" /> : any
>Component : any
{...this.props} sound="moo" />;
>this.props : any
>this : any
>props : any
>sound : any
<font-face />;
><font-face /> : any
>font-face : any
<Component x={y} />;
><Component x={y} /> : any
>Component : any
>x : any
>y : any
<x-component />;
><x-component /> : any
>x-component : any
<Component {...x} />;
><Component {...x} /> : any
>Component : any
>x : any
<Component { ...x } y={2} />;
><Component { ...x } y={2} /> : any
>Component : any
>x : any
>y : any
<Component { ... x } y={2} z />;
><Component { ... x } y={2} z /> : any
>Component : any
>x : any
>y : any
>z : any
<Component x={1} {...y} />;
><Component x={1} {...y} /> : any
>Component : any
>x : any
>y : any
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
><Component x={1} y="2" {...z} {...z}><Child /></Component> : any
>Component : any
>x : any
>y : any
>z : any
>z : any
><Child /> : any
>Child : any
>Component : any
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
><Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component> : any
>Component : any
>x : any
>(z = { y: 2 }, z) : any
>z = { y: 2 }, z : any
>z = { y: 2 } : { y: number; }
>z : any
>{ y: 2 } : { y: number; }
>y : number
>2 : number
>z : any
>z : any
>Component : any

View File

@@ -1,40 +0,0 @@
tests/cases/conformance/jsx/tsxElementResolution.tsx(18,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxElementResolution.tsx(19,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxElementResolution.tsx(23,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxElementResolution.tsx(24,9): error TS2602: The global type 'JSX.Element' must exist when using JSX.
==== tests/cases/conformance/jsx/tsxElementResolution.tsx (4 errors) ====
declare namespace JSX {
interface IntrinsicElements {
foundFirst: { x: string };
'string_named';
'var';
}
}
class foundFirst { }
class Other {}
module Dotted {
export class Name { }
}
// Should find the intrinsic element, not the class element
var a = <foundFirst x="hello" />;
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
var b = <string_named />;
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// TODO: This should not be a parse error (should
// parse a property name here, not identifier)
// var c = <var />;
var d = <Other />;
~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
var e = <Dotted.Name />;
~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.

View File

@@ -0,0 +1,51 @@
=== tests/cases/conformance/jsx/tsxElementResolution.tsx ===
declare namespace JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution.tsx, 0, 0))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxElementResolution.tsx, 1, 23))
foundFirst: { x: string };
>foundFirst : Symbol(foundFirst, Decl(tsxElementResolution.tsx, 2, 30))
>x : Symbol(x, Decl(tsxElementResolution.tsx, 3, 15))
'string_named';
'var';
}
}
class foundFirst { }
>foundFirst : Symbol(foundFirst, Decl(tsxElementResolution.tsx, 7, 1))
class Other {}
>Other : Symbol(Other, Decl(tsxElementResolution.tsx, 9, 20))
module Dotted {
>Dotted : Symbol(Dotted, Decl(tsxElementResolution.tsx, 10, 14))
export class Name { }
>Name : Symbol(Name, Decl(tsxElementResolution.tsx, 12, 15))
}
// Should find the intrinsic element, not the class element
var a = <foundFirst x="hello" />;
>a : Symbol(a, Decl(tsxElementResolution.tsx, 17, 3))
>foundFirst : Symbol(JSX.IntrinsicElements.foundFirst, Decl(tsxElementResolution.tsx, 2, 30))
>x : Symbol(x, Decl(tsxElementResolution.tsx, 3, 15))
var b = <string_named />;
>b : Symbol(b, Decl(tsxElementResolution.tsx, 18, 3))
>string_named : Symbol(JSX.IntrinsicElements.'string_named', Decl(tsxElementResolution.tsx, 3, 28))
// TODO: This should not be a parse error (should
// parse a property name here, not identifier)
// var c = <var />;
var d = <Other />;
>d : Symbol(d, Decl(tsxElementResolution.tsx, 22, 3))
>Other : Symbol(Other, Decl(tsxElementResolution.tsx, 9, 20))
var e = <Dotted.Name />;
>e : Symbol(e, Decl(tsxElementResolution.tsx, 23, 3))
>Name : Symbol(Dotted.Name, Decl(tsxElementResolution.tsx, 12, 15))

View File

@@ -0,0 +1,56 @@
=== tests/cases/conformance/jsx/tsxElementResolution.tsx ===
declare namespace JSX {
>JSX : any
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
foundFirst: { x: string };
>foundFirst : { x: string; }
>x : string
'string_named';
'var';
}
}
class foundFirst { }
>foundFirst : foundFirst
class Other {}
>Other : Other
module Dotted {
>Dotted : typeof Dotted
export class Name { }
>Name : Name
}
// Should find the intrinsic element, not the class element
var a = <foundFirst x="hello" />;
>a : any
><foundFirst x="hello" /> : any
>foundFirst : typeof foundFirst
>x : any
var b = <string_named />;
>b : any
><string_named /> : any
>string_named : any
// TODO: This should not be a parse error (should
// parse a property name here, not identifier)
// var c = <var />;
var d = <Other />;
>d : any
><Other /> : any
>Other : typeof Other
var e = <Dotted.Name />;
>e : any
><Dotted.Name /> : any
>Dotted : any
>Name : any

View File

@@ -1,7 +1,8 @@
tests/cases/conformance/jsx/tsxElementResolution16.tsx(8,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxElementResolution16.tsx(8,1): error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.
tests/cases/conformance/jsx/tsxElementResolution16.tsx(8,1): error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists
==== tests/cases/conformance/jsx/tsxElementResolution16.tsx (1 errors) ====
==== tests/cases/conformance/jsx/tsxElementResolution16.tsx (2 errors) ====
declare module JSX {
}
@@ -9,7 +10,9 @@ tests/cases/conformance/jsx/tsxElementResolution16.tsx(8,1): error TS2602: The g
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // Error (JSX.Element is missing)
<obj1 x={10} />; // Error (JSX.Element is implicit any)
~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
!!! error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist.
~~~~~~~~~~~~~~~
!!! error TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists

View File

@@ -6,9 +6,9 @@ interface Obj1 {
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // Error (JSX.Element is missing)
<obj1 x={10} />; // Error (JSX.Element is implicit any)
//// [tsxElementResolution16.jsx]
var obj1;
<obj1 x={10}/>; // Error (JSX.Element is missing)
<obj1 x={10}/>; // Error (JSX.Element is implicit any)

View File

@@ -0,0 +1,18 @@
=== tests/cases/conformance/jsx/tsxElementResolution16.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution16.tsx, 0, 0))
}
interface Obj1 {
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution16.tsx, 1, 1))
new(n: string): {};
>n : Symbol(n, Decl(tsxElementResolution16.tsx, 4, 5))
}
var obj1: Obj1;
>obj1 : Symbol(obj1, Decl(tsxElementResolution16.tsx, 6, 3))
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution16.tsx, 1, 1))
<obj1 x={10} />; // Error (JSX.Element is missing)
>x : Symbol(unknown)

View File

@@ -0,0 +1,20 @@
=== tests/cases/conformance/jsx/tsxElementResolution16.tsx ===
declare module JSX {
>JSX : any
}
interface Obj1 {
>Obj1 : Obj1
new(n: string): {};
>n : string
}
var obj1: Obj1;
>obj1 : Obj1
>Obj1 : Obj1
<obj1 x={10} />; // Error (JSX.Element is missing)
><obj1 x={10} /> : any
>obj1 : Obj1
>x : any

View File

@@ -1,9 +0,0 @@
tests/cases/conformance/jsx/tsxNoJsx.tsx(2,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
==== tests/cases/conformance/jsx/tsxNoJsx.tsx (1 errors) ====
<nope />;
~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.

View File

@@ -0,0 +1,5 @@
=== tests/cases/conformance/jsx/tsxNoJsx.tsx ===
No type information for this code.<nope />;
No type information for this code.
No type information for this code.

View File

@@ -0,0 +1,6 @@
=== tests/cases/conformance/jsx/tsxNoJsx.tsx ===
<nope />;
><nope /> : any
>nope : any

View File

@@ -1,55 +0,0 @@
tests/cases/conformance/jsx/tsxTypeErrors.tsx(3,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxTypeErrors.tsx(6,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxTypeErrors.tsx(10,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxTypeErrors.tsx(13,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxTypeErrors.tsx(26,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/tsxTypeErrors.tsx(32,10): error TS2602: The global type 'JSX.Element' must exist when using JSX.
==== tests/cases/conformance/jsx/tsxTypeErrors.tsx (6 errors) ====
// A built-in element (OK)
var a1 = <div id="foo" />;
~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// A built-in element with a mistyped property (error)
var a2 = <img srce="foo.jpg" />
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// A built-in element with a badly-typed attribute value (error)
var thing = { oops: 100 };
var a3 = <div id={thing} />
~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// Mistyped html name (error)
var e1 = <imag src="bar.jpg" />
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// A custom type
class MyClass {
props: {
pt?: { x: number; y: number; };
name?: string;
reqd: boolean;
}
}
// Let's use it
// TODO: Error on missing 'reqd'
var b1 = <MyClass reqd={true} />;
~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
// Mistyped attribute member
// sample.tsx(23,22): error TS2322: Type '{ x: number; y: string; }' is not assignable to type '{ x: number; y: number; }'.
// Types of property 'y' are incompatible.
// Type 'string' is not assignable to type 'number'.
var b2 = <MyClass pt={{x: 4, y: 'oops'}} />;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.

View File

@@ -0,0 +1,65 @@
=== tests/cases/conformance/jsx/tsxTypeErrors.tsx ===
// A built-in element (OK)
var a1 = <div id="foo" />;
>a1 : Symbol(a1, Decl(tsxTypeErrors.tsx, 2, 3))
>id : Symbol(unknown)
// A built-in element with a mistyped property (error)
var a2 = <img srce="foo.jpg" />
>a2 : Symbol(a2, Decl(tsxTypeErrors.tsx, 5, 3))
>srce : Symbol(unknown)
// A built-in element with a badly-typed attribute value (error)
var thing = { oops: 100 };
>thing : Symbol(thing, Decl(tsxTypeErrors.tsx, 8, 3))
>oops : Symbol(oops, Decl(tsxTypeErrors.tsx, 8, 13))
var a3 = <div id={thing} />
>a3 : Symbol(a3, Decl(tsxTypeErrors.tsx, 9, 3))
>id : Symbol(unknown)
// Mistyped html name (error)
var e1 = <imag src="bar.jpg" />
>e1 : Symbol(e1, Decl(tsxTypeErrors.tsx, 12, 3))
>src : Symbol(unknown)
// A custom type
class MyClass {
>MyClass : Symbol(MyClass, Decl(tsxTypeErrors.tsx, 12, 31))
props: {
>props : Symbol(props, Decl(tsxTypeErrors.tsx, 15, 15))
pt?: { x: number; y: number; };
>pt : Symbol(pt, Decl(tsxTypeErrors.tsx, 16, 10))
>x : Symbol(x, Decl(tsxTypeErrors.tsx, 17, 10))
>y : Symbol(y, Decl(tsxTypeErrors.tsx, 17, 21))
name?: string;
>name : Symbol(name, Decl(tsxTypeErrors.tsx, 17, 35))
reqd: boolean;
>reqd : Symbol(reqd, Decl(tsxTypeErrors.tsx, 18, 15))
}
}
// Let's use it
// TODO: Error on missing 'reqd'
var b1 = <MyClass reqd={true} />;
>b1 : Symbol(b1, Decl(tsxTypeErrors.tsx, 25, 3))
>MyClass : Symbol(MyClass, Decl(tsxTypeErrors.tsx, 12, 31))
>reqd : Symbol(unknown)
// Mistyped attribute member
// sample.tsx(23,22): error TS2322: Type '{ x: number; y: string; }' is not assignable to type '{ x: number; y: number; }'.
// Types of property 'y' are incompatible.
// Type 'string' is not assignable to type 'number'.
var b2 = <MyClass pt={{x: 4, y: 'oops'}} />;
>b2 : Symbol(b2, Decl(tsxTypeErrors.tsx, 31, 3))
>MyClass : Symbol(MyClass, Decl(tsxTypeErrors.tsx, 12, 31))
>pt : Symbol(unknown)
>x : Symbol(x, Decl(tsxTypeErrors.tsx, 31, 23))
>y : Symbol(y, Decl(tsxTypeErrors.tsx, 31, 28))

View File

@@ -0,0 +1,82 @@
=== tests/cases/conformance/jsx/tsxTypeErrors.tsx ===
// A built-in element (OK)
var a1 = <div id="foo" />;
>a1 : any
><div id="foo" /> : any
>div : any
>id : any
// A built-in element with a mistyped property (error)
var a2 = <img srce="foo.jpg" />
>a2 : any
><img srce="foo.jpg" /> : any
>img : any
>srce : any
// A built-in element with a badly-typed attribute value (error)
var thing = { oops: 100 };
>thing : { oops: number; }
>{ oops: 100 } : { oops: number; }
>oops : number
>100 : number
var a3 = <div id={thing} />
>a3 : any
><div id={thing} /> : any
>div : any
>id : any
>thing : any
// Mistyped html name (error)
var e1 = <imag src="bar.jpg" />
>e1 : any
><imag src="bar.jpg" /> : any
>imag : any
>src : any
// A custom type
class MyClass {
>MyClass : MyClass
props: {
>props : { pt?: { x: number; y: number; }; name?: string; reqd: boolean; }
pt?: { x: number; y: number; };
>pt : { x: number; y: number; }
>x : number
>y : number
name?: string;
>name : string
reqd: boolean;
>reqd : boolean
}
}
// Let's use it
// TODO: Error on missing 'reqd'
var b1 = <MyClass reqd={true} />;
>b1 : any
><MyClass reqd={true} /> : any
>MyClass : typeof MyClass
>reqd : any
>true : boolean
// Mistyped attribute member
// sample.tsx(23,22): error TS2322: Type '{ x: number; y: string; }' is not assignable to type '{ x: number; y: number; }'.
// Types of property 'y' are incompatible.
// Type 'string' is not assignable to type 'number'.
var b2 = <MyClass pt={{x: 4, y: 'oops'}} />;
>b2 : any
><MyClass pt={{x: 4, y: 'oops'}} /> : any
>MyClass : typeof MyClass
>pt : any
>{x: 4, y: 'oops'} : { x: number; y: string; }
>x : number
>4 : number
>y : string
>'oops' : string

View File

@@ -1,5 +1,6 @@
//@filename: file.tsx
//@jsx: preserve
//@noImplicitAny: true
declare module JSX {
}
@@ -7,4 +8,4 @@ interface Obj1 {
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // Error (JSX.Element is missing)
<obj1 x={10} />; // Error (JSX.Element is implicit any)

View File

@@ -0,0 +1,23 @@
// @jsx: preserve
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
div: {
text?: string;
}
}
}
// didn't work
<div>{() => <div text="wat" />}</div>;
// didn't work
<div>{x => <div text="wat" />}</div>;
// worked
<div>{() => (<div text="wat" />)}</div>;
// worked (!)
<div>{() => <div text="wat"></div>}</div>;