Baseline-accept

This commit is contained in:
Ryan Cavanaugh
2015-06-18 14:04:11 -07:00
parent bc9b53a6fe
commit a5c44a3012
125 changed files with 5405 additions and 15 deletions
+11 -11
View File
@@ -75,28 +75,28 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 189 /* ForStatement */:
case 190 /* ForInStatement */:
case 188 /* WhileStatement */:
case 187 /* DoStatement */:
if (node.statement.kind !== 182 /* Block */) {
case 191 /* ForStatement */:
case 192 /* ForInStatement */:
case 190 /* WhileStatement */:
case 189 /* DoStatement */:
if (node.statement.kind !== 184 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 186 /* IfStatement */:
case 188 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 182 /* Block */) {
if (ifStatement.thenStatement.kind !== 184 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement &&
ifStatement.elseStatement.kind !== 182 /* Block */ &&
ifStatement.elseStatement.kind !== 186 /* IfStatement */) {
ifStatement.elseStatement.kind !== 184 /* Block */ &&
ifStatement.elseStatement.kind !== 188 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 172 /* BinaryExpression */:
case 173 /* BinaryExpression */:
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
if (op === 29 /* EqualsEqualsToken */ || op == 30 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
}
break;
+19
View File
@@ -0,0 +1,19 @@
//// [asOperator1.ts]
var as = 43;
var x = undefined as number;
var y = (null as string).length;
var z = Date as any as string;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
j = '';
//// [asOperator1.js]
var as = 43;
var x = undefined;
var y = null.length;
var z = Date;
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32;
j = '';
@@ -0,0 +1,24 @@
=== tests/cases/conformance/expressions/asOperator/asOperator1.ts ===
var as = 43;
>as : Symbol(as, Decl(asOperator1.ts, 0, 3))
var x = undefined as number;
>x : Symbol(x, Decl(asOperator1.ts, 1, 3))
>undefined : Symbol(undefined)
var y = (null as string).length;
>y : Symbol(y, Decl(asOperator1.ts, 2, 3))
>(null as string).length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
>length : Symbol(String.length, Decl(lib.d.ts, 414, 19))
var z = Date as any as string;
>z : Symbol(z, Decl(asOperator1.ts, 3, 3))
>Date : Symbol(Date, Decl(lib.d.ts, 633, 23), Decl(lib.d.ts, 815, 11))
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
>j : Symbol(j, Decl(asOperator1.ts, 6, 3))
j = '';
>j : Symbol(j, Decl(asOperator1.ts, 6, 3))
@@ -0,0 +1,35 @@
=== tests/cases/conformance/expressions/asOperator/asOperator1.ts ===
var as = 43;
>as : number
>43 : number
var x = undefined as number;
>x : number
>undefined as number : number
>undefined : undefined
var y = (null as string).length;
>y : number
>(null as string).length : number
>(null as string) : string
>null as string : string
>null : null
>length : number
var z = Date as any as string;
>z : string
>Date as any as string : string
>Date as any : any
>Date : DateConstructor
// Should parse as a union type, not a bitwise 'or' of (32 as number) and 'string'
var j = 32 as number|string;
>j : string | number
>32 as number|string : string | number
>32 : number
j = '';
>j = '' : string
>j : string | number
>'' : string
@@ -0,0 +1,8 @@
tests/cases/conformance/expressions/asOperator/asOperator2.ts(1,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
==== tests/cases/conformance/expressions/asOperator/asOperator2.ts (1 errors) ====
var x = 23 as string;
~~~~~~~~~~~~
!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
+6
View File
@@ -0,0 +1,6 @@
//// [asOperator2.ts]
var x = 23 as string;
//// [asOperator2.js]
var x = 23;
+22
View File
@@ -0,0 +1,22 @@
//// [asOperator3.ts]
declare function tag(...x: any[]): any;
var a = `${123 + 456 as number}`;
var b = `leading ${123 + 456 as number}`;
var c = `${123 + 456 as number} trailing`;
var d = `Hello ${123} World` as string;
var e = `Hello` as string;
var f = 1 + `${1} end of string` as string;
var g = tag `Hello ${123} World` as string;
var h = tag `Hello` as string;
//// [asOperator3.js]
var a = "" + 123 + 456;
var b = "leading " + 123 + 456;
var c = 123 + 456 + " trailing";
var d = ("Hello " + 123 + " World");
var e = "Hello";
var f = 1 + (1 + " end of string");
var g = (_a = ["Hello ", " World"], _a.raw = ["Hello ", " World"], tag(_a, 123));
var h = (_b = ["Hello"], _b.raw = ["Hello"], tag(_b));
var _a, _b;
@@ -0,0 +1,31 @@
=== tests/cases/conformance/expressions/asOperator/asOperator3.ts ===
declare function tag(...x: any[]): any;
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))
>x : Symbol(x, Decl(asOperator3.ts, 0, 21))
var a = `${123 + 456 as number}`;
>a : Symbol(a, Decl(asOperator3.ts, 2, 3))
var b = `leading ${123 + 456 as number}`;
>b : Symbol(b, Decl(asOperator3.ts, 3, 3))
var c = `${123 + 456 as number} trailing`;
>c : Symbol(c, Decl(asOperator3.ts, 4, 3))
var d = `Hello ${123} World` as string;
>d : Symbol(d, Decl(asOperator3.ts, 5, 3))
var e = `Hello` as string;
>e : Symbol(e, Decl(asOperator3.ts, 6, 3))
var f = 1 + `${1} end of string` as string;
>f : Symbol(f, Decl(asOperator3.ts, 7, 3))
var g = tag `Hello ${123} World` as string;
>g : Symbol(g, Decl(asOperator3.ts, 8, 3))
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))
var h = tag `Hello` as string;
>h : Symbol(h, Decl(asOperator3.ts, 9, 3))
>tag : Symbol(tag, Decl(asOperator3.ts, 0, 0))
@@ -0,0 +1,63 @@
=== tests/cases/conformance/expressions/asOperator/asOperator3.ts ===
declare function tag(...x: any[]): any;
>tag : (...x: any[]) => any
>x : any[]
var a = `${123 + 456 as number}`;
>a : string
>`${123 + 456 as number}` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var b = `leading ${123 + 456 as number}`;
>b : string
>`leading ${123 + 456 as number}` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var c = `${123 + 456 as number} trailing`;
>c : string
>`${123 + 456 as number} trailing` : string
>123 + 456 as number : number
>123 + 456 : number
>123 : number
>456 : number
var d = `Hello ${123} World` as string;
>d : string
>`Hello ${123} World` as string : string
>`Hello ${123} World` : string
>123 : number
var e = `Hello` as string;
>e : string
>`Hello` as string : string
>`Hello` : string
var f = 1 + `${1} end of string` as string;
>f : string
>1 + `${1} end of string` as string : string
>1 + `${1} end of string` : string
>1 : number
>`${1} end of string` : string
>1 : number
var g = tag `Hello ${123} World` as string;
>g : string
>tag `Hello ${123} World` as string : string
>tag `Hello ${123} World` : any
>tag : (...x: any[]) => any
>`Hello ${123} World` : string
>123 : number
var h = tag `Hello` as string;
>h : string
>tag `Hello` as string : string
>tag `Hello` : any
>tag : (...x: any[]) => any
>`Hello` : string
@@ -0,0 +1,26 @@
//// [asOperatorASI.ts]
class Foo { }
declare function as(...args: any[]);
// Example 1
var x = 10
as `Hello world`; // should not error
// Example 2
var y = 20
as(Foo); // should emit
//// [asOperatorASI.js]
var Foo = (function () {
function Foo() {
}
return Foo;
})();
// Example 1
var x = 10;
(_a = ["Hello world"], _a.raw = ["Hello world"], as(_a)); // should not error
// Example 2
var y = 20;
as(Foo); // should emit
var _a;
@@ -0,0 +1,23 @@
=== tests/cases/conformance/expressions/asOperator/asOperatorASI.ts ===
class Foo { }
>Foo : Symbol(Foo, Decl(asOperatorASI.ts, 0, 0))
declare function as(...args: any[]);
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
>args : Symbol(args, Decl(asOperatorASI.ts, 1, 20))
// Example 1
var x = 10
>x : Symbol(x, Decl(asOperatorASI.ts, 4, 3))
as `Hello world`; // should not error
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
// Example 2
var y = 20
>y : Symbol(y, Decl(asOperatorASI.ts, 8, 3))
as(Foo); // should emit
>as : Symbol(as, Decl(asOperatorASI.ts, 0, 13))
>Foo : Symbol(Foo, Decl(asOperatorASI.ts, 0, 0))
@@ -0,0 +1,28 @@
=== tests/cases/conformance/expressions/asOperator/asOperatorASI.ts ===
class Foo { }
>Foo : Foo
declare function as(...args: any[]);
>as : (...args: any[]) => any
>args : any[]
// Example 1
var x = 10
>x : number
>10 : number
as `Hello world`; // should not error
>as `Hello world` : any
>as : (...args: any[]) => any
>`Hello world` : string
// Example 2
var y = 20
>y : number
>20 : number
as(Foo); // should emit
>as(Foo) : any
>as : (...args: any[]) => any
>Foo : typeof Foo
@@ -0,0 +1,15 @@
tests/cases/conformance/expressions/asOperator/asOperatorAmbiguity.ts(7,14): error TS2339: Property 'm' does not exist on type 'A<B>'.
==== tests/cases/conformance/expressions/asOperator/asOperatorAmbiguity.ts (1 errors) ====
interface A<T> { x: T; }
interface B { m: string; }
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x: any;
var y = x as A<B>[];
var z = y[0].m; // z should be string
~
!!! error TS2339: Property 'm' does not exist on type 'A<B>'.
@@ -0,0 +1,16 @@
//// [asOperatorAmbiguity.ts]
interface A<T> { x: T; }
interface B { m: string; }
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x: any;
var y = x as A<B>[];
var z = y[0].m; // z should be string
//// [asOperatorAmbiguity.js]
// Make sure this is a type assertion to an array type, and not nested comparison operators.
var x;
var y = x;
var z = y[0].m; // z should be string
@@ -0,0 +1,10 @@
tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts(2,9): error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/expressions/asOperator/asOperatorContextualType.ts (1 errors) ====
// should error
var x = (v => v) as (x: number) => string;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2352: Neither type '(v: number) => number' nor type '(x: number) => string' is assignable to the other.
!!! error TS2352: Type 'number' is not assignable to type 'string'.
@@ -0,0 +1,7 @@
//// [asOperatorContextualType.ts]
// should error
var x = (v => v) as (x: number) => string;
//// [asOperatorContextualType.js]
// should error
var x = (function (v) { return v; });
@@ -0,0 +1,11 @@
tests/cases/conformance/expressions/asOperator/asOperatorNames.ts(2,9): error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
==== tests/cases/conformance/expressions/asOperator/asOperatorNames.ts (1 errors) ====
var a = 20;
var b = a as string;
~~~~~~~~~~~
!!! error TS2352: Neither type 'number' nor type 'string' is assignable to the other.
var as = "hello";
var as1 = as as string;
@@ -0,0 +1,12 @@
//// [asOperatorNames.ts]
var a = 20;
var b = a as string;
var as = "hello";
var as1 = as as string;
//// [asOperatorNames.js]
var a = 20;
var b = a;
var as = "hello";
var as1 = as;
@@ -0,0 +1,125 @@
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) ====
declare var createElement: any;
class foo {}
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 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 TS2602: The global type 'JSX.Element' must exist when using JSX.
!!! error TS1005: ':' expected.
!!! error TS17002: Expected corresponding JSX closing tag for 'any'.
!!! error TS17002: Expected corresponding JSX closing tag for 'foo'.
@@ -0,0 +1,47 @@
//// [jsxAndTypeAssertion.tsx]
declare var createElement: any;
class foo {}
var x: any;
x = <any> { test: <any></any> };
x = <any><any></any>;
x = <foo>hello {<foo>{}} </foo>;
x = <foo test={<foo>{}}>hello</foo>;
x = <foo test={<foo>{}}>hello{<foo>{}}</foo>;
x = <foo>x</foo>, x = <foo/>;
<foo>{<foo><foo>{/foo/.test(x) ? <foo><foo></foo> : <foo><foo></foo>}</foo>}</foo>
//// [jsxAndTypeAssertion.jsx]
var foo = (function () {
function foo() {
}
return foo;
})();
var x;
x = <any> {test}: <any></any> };
x = <any><any></any>;
x = <foo>hello {<foo>} </foo>};
x = <foo test={<foo>}>hello</foo>} x=<foo test={<foo>}>hello{<foo>}</foo>};
x = <foo>x</foo>, x = <foo />;
<foo>{<foo><foo>{/foo/.test(x) ? <foo><foo></foo> : <foo><foo></foo>}</foo>}</foo>
:
}
</></>}</></>}></>></></></></>;
@@ -0,0 +1,131 @@
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.
@@ -0,0 +1,81 @@
//// [jsxEsprimaFbTestSuite.tsx]
declare var React: any;
declare var ;
declare var AbC_def;
declare var LeftRight;
declare var x;
declare var a;
declare var props;
<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;" />;
<a b="&notanentity;" />;
<a
/>;
<日本語></日本語>;
<AbC_def
test="&#x0026;&#38;">
bar
baz
</AbC_def>;
<a b={x ? <c /> : <d />} />;
<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> />;
<a.b></a.b>;
<a.b.c></a.b.c>;
(<div />) < x;
<div {...props} />;
<div {...props} post="attribute" />;
<div pre="leading" pre2="attribute" {...props}></div>;
<a> </a>;
//// [jsxEsprimaFbTestSuite.jsx]
<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;"/>;
<a b="&notanentity;"/>;
<a />;
<日本語></日本語>;
<AbC_def test="&#x0026;&#38;">
bar
baz
</AbC_def>;
<a b={x ? <c /> : <d />}/>;
<a></a>;
<a></a>;
<div>@test content</div>;
<div><br />7x invalid-js-identifier</div>;
<LeftRight left=<a /> right=<b>monkeys /> gorillas</b>/>;
<a.b></a.b>;
<a.b.c></a.b.c>;
(<div />) < x;
<div {...props}/>;
<div {...props} post="attribute"/>;
<div pre="leading" pre2="attribute" {...props}></div>;
<a> </a>;
@@ -0,0 +1,283 @@
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(3,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(3,2): error TS1003: Identifier 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 TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(5,2): error TS1003: Identifier 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.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(6,10): error TS1109: Expression expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(7,1): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(7,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
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,1): error TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,3): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(10,6): error TS17002: Expected corresponding JSX closing tag for 'a'.
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(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(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 TS2602: The global type 'JSX.Element' must exist when using JSX.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,2): error TS1003: Identifier expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(14,7): error TS1003: Identifier 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,12): error TS1005: '>' 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,14): error TS1005: '>' 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 TS1005: '</' expected.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002: Expected corresponding JSX closing tag for 'a'.
tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx(35,21): error TS17002: Expected corresponding JSX closing tag for 'div'.
==== tests/cases/conformance/jsx/jsxInvalidEsprimaTestSuite.tsx (81 errors) ====
declare var React: any;
</>;
~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<a: />;
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<:a />;
~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
<a b=d />;
~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1005: '{' expected.
~
!!! error TS2304: Cannot find name 'd'.
~
!!! error TS1109: Expression expected.
~
!!! error TS1109: Expression expected.
<a>;
~
!!! error TS1003: Identifier expected.
~~~
!!! 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 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>;
~
!!! error TS1003: Identifier expected.
~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~~~~
!!! error TS17002: Expected corresponding JSX closing tag for 'a'.
<a:b.c></a:b.c>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: '>' 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'.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: '>' expected.
<a.b.c></a>;
~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2304: Cannot find name 'a'.
~~~~
!!! error TS17002: Expected corresponding JSX closing tag for 'a.b.c'.
<.a></.a>;
~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1003: Identifier expected.
<a.></a.>;
~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS2304: Cannot find name 'a'.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1003: Identifier expected.
<a[foo]></a[foo]>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: '>' expected.
<a['foo']></a['foo']>;
~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
~
!!! error TS1003: Identifier expected.
~
!!! error TS1005: '>' 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'.
~
!!! error TS1005: '>' expected.
~~~
!!! 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 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 TS2602: The global type 'JSX.Element' must exist when using JSX.
~~~
!!! error TS1003: Identifier expected.
!!! error TS1005: '</' expected.
!!! error TS17002: Expected corresponding JSX closing tag for 'a'.
!!! error TS17002: Expected corresponding JSX closing tag for 'div'.
@@ -0,0 +1,71 @@
//// [jsxInvalidEsprimaTestSuite.tsx]
declare var React: any;
</>;
<a: />;
<:a />;
<a b=d />;
<a>;
<a></b>;
<a foo="bar;
<a:b></b>;
<a:b.c></a:b.c>;
<a.b:c></a.b:c>;
<a.b.c></a>;
<.a></.a>;
<a.></a.>;
<a[foo]></a[foo]>;
<a['foo']></a['foo']>;
<a><a />;
<a b={}>;
var x = <div>one</div><div>two</div>;;
var x = <div>one</div> /* intervening comment */ <div>two</div>;;
<a>{"str";}</a>;
<span className="a", id="b" />;
<div className"app">;
<div {props} />;
<div>stuff</div {...props}>;
<div {...props}>stuff</div {...props}>;
<a>></a>;
<a> ></a>;
<a b=}>;
<a b=<}>;
<a>}</a>;
<a .../*hai*/asdf/>;
//// [jsxInvalidEsprimaTestSuite.jsx]
< />;
<a />;
< a=/>;
<a b={d / > }>
<a>;
<a></b>;
<a foo="bar;>
<a b=></b>;
<a b= c=></a>:b.c>;
<a.b c=></a.b>:c>;
<a.b.c></a>;
<.a></.a>;
<a.></a.>;
<a>[foo]></a>[foo]>;
<a>['foo']></a>['foo']>;
<a><a />;
<a b=>;
var x = <div>one</div><div>two</div>;;
var x = <div>one</div> /* intervening comment */ /* intervening comment */ <div>two</div>;;
<a>{"str"};}</a>;
<span className="a" id="b"/>;
<div className=>"app">;
<div {...props}/>;
<div>stuff</div> {}...props}>;
<div {...props}>stuff</div> {}...props}>;
<a>></a>;
<a> ></a>;
<a b=>;
<a b=<>}>;
<a>}</a>;
<a asdf=/>;</>></></></></></></></></>;
@@ -0,0 +1,246 @@
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.
@@ -0,0 +1,171 @@
//// [jsxReactTestSuite.tsx]
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>;
<div>
{this.props.children}
</div>;
<div>
<div><br /></div>
<Component>{foo}<br />{bar}</Component>
<br />
</div>;
<Composite>
{this.props.children}
</Composite>;
<Composite>
<Composite2 />
</Composite>;
var x =
<div
attr1={
"foo" + "bar"
}
attr2={
"foo" + "bar" +
"baz" + "bug"
}
attr3={
"foo" + "bar" +
"baz" + "bug"
// Extra line here.
}
attr4="baz">
</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">
<span // a double-slash comment
attr2="bar"
/>
</div>
);
<div>&nbsp;</div>;
<div>&nbsp; </div>;
<hasOwnProperty>testing</hasOwnProperty>;
<Component constructor="foo" />;
<Namespace.Component />;
<Namespace.DeepNamespace.Component />;
<Component { ... x } y
={2 } z />;
<Component
{...this.props} sound="moo" />;
<font-face />;
<Component x={y} />;
<x-component />;
<Component {...x} />;
<Component { ...x } y={2} />;
<Component { ... x } y={2} z />;
<Component x={1} {...y} />;
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
//// [jsxReactTestSuite.jsx]
<div>text</div>;
<div>
{this.props.children}
</div>;
<div>
<div><br /></div>
<Component>{foo}<br />{bar}</Component>
<br />
</div>;
<Composite>
{this.props.children}
</Composite>;
<Composite>
<Composite2 />
</Composite>;
var x = <div attr1={"foo" + "bar"} attr2={"foo" + "bar" +
"baz" + "bug"} attr3={"foo" + "bar" +
"baz" + "bug"} attr4="baz">
</div>;
(<div>
<span>
</span>
<br />
</div>);
(<div attr1="foo">
<span // a double-slash comment
attr2="bar"/>
</div>);
<div>&nbsp;</div>;
<div>&nbsp; </div>;
<hasOwnProperty>testing</hasOwnProperty>;
<Component constructor="foo"/>;
<Namespace.Component />;
<Namespace.DeepNamespace.Component />;
<Component {...x} y={2} z=/>;
<Component {...this.props} sound="moo"/>;
<font-face />;
<Component x={y}/>;
<x-component />;
<Component {...x}/>;
<Component {...x} y={2}/>;
<Component {...x} y={2} z=/>;
<Component x={1} {...y}/>;
<Component x={1} y="2" {...z} {...z}><Child /></Component>;
<Component x="1" {...(z = { y: 2 }, z)} z={3}>Text</Component>;
@@ -1,6 +1,6 @@
error TS6053: File 'a.ts' not found.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'.
!!! error TS6053: File 'a.ts' not found.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'.
@@ -1,6 +1,6 @@
error TS6053: File 'a.ts' not found.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'.
!!! error TS6053: File 'a.ts' not found.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.ts', '.d.ts'.
!!! error TS6054: File 'a.t' has unsupported extension. The only supported extensions are '.tsx', '.ts', '.d.ts'.
@@ -0,0 +1,40 @@
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(15,6): error TS2322: Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(18,6): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/tsxAttributeErrors.tsx(22,6): error TS2606: Property 'text' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeErrors.tsx (3 errors) ====
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
div: {
text?: string;
width?: number;
}
span: any;
}
}
// Error, number is not assignable to string
<div text={42} />;
~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
// Error, string is not assignable to number
<div width={'foo'} />;
~~~~~~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
// Error, number is not assignable to string
var attribs = { text: 100 };
<div {...attribs} />;
~~~~~~~~~~~~
!!! error TS2606: Property 'text' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// No errors here
<span foo='bar' bar={'foo'} />;
@@ -0,0 +1,38 @@
//// [tsxAttributeErrors.tsx]
declare namespace JSX {
interface Element { }
interface IntrinsicElements {
div: {
text?: string;
width?: number;
}
span: any;
}
}
// Error, number is not assignable to string
<div text={42} />;
// Error, string is not assignable to number
<div width={'foo'} />;
// Error, number is not assignable to string
var attribs = { text: 100 };
<div {...attribs} />;
// No errors here
<span foo='bar' bar={'foo'} />;
//// [tsxAttributeErrors.jsx]
// Error, number is not assignable to string
<div text={42}/>;
// Error, string is not assignable to number
<div width={'foo'}/>;
// Error, number is not assignable to string
var attribs = { text: 100 };
<div {...attribs}/>;
// No errors here
<span foo='bar' bar={'foo'}/>;
@@ -0,0 +1,25 @@
tests/cases/conformance/jsx/tsxAttributeInvalidNames.tsx(9,8): error TS1003: Identifier expected.
tests/cases/conformance/jsx/tsxAttributeInvalidNames.tsx(10,8): error TS1003: Identifier expected.
tests/cases/conformance/jsx/tsxAttributeInvalidNames.tsx(10,22): error TS1005: '</' expected.
tests/cases/conformance/jsx/tsxAttributeInvalidNames.tsx(10,22): error TS17002: Expected corresponding JSX closing tag for 'test1'.
==== tests/cases/conformance/jsx/tsxAttributeInvalidNames.tsx (4 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { "data-foo"?: string };
}
}
// Invalid names
<test1 32data={32} />;
~~
!!! error TS1003: Identifier expected.
<test1 -data={32} />;
~
!!! error TS1003: Identifier expected.
!!! error TS1005: '</' expected.
!!! error TS17002: Expected corresponding JSX closing tag for 'test1'.
@@ -0,0 +1,16 @@
//// [tsxAttributeInvalidNames.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { "data-foo"?: string };
}
}
// Invalid names
<test1 32data={32} />;
<test1 -data={32} />;
//// [tsxAttributeInvalidNames.jsx]
// Invalid names
<test1> 32data={32} />;
<test1> -data={32} />;</></>;
@@ -0,0 +1,14 @@
//// [tsxAttributeResolution.tsx]
/// @jsx: preserve
declare namespace JSX {
interface IntrinsicElements {
x: { y: number; z: string; };
}
}
//// [tsxAttributeResolution.jsx]
/// @jsx: preserve
@@ -0,0 +1,18 @@
=== tests/cases/conformance/jsx/tsxAttributeResolution.tsx ===
/// @jsx: preserve
declare namespace JSX {
>JSX : Symbol(JSX, Decl(tsxAttributeResolution.tsx, 0, 0))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxAttributeResolution.tsx, 2, 23))
x: { y: number; z: string; };
>x : Symbol(x, Decl(tsxAttributeResolution.tsx, 3, 30))
>y : Symbol(y, Decl(tsxAttributeResolution.tsx, 4, 6))
>z : Symbol(z, Decl(tsxAttributeResolution.tsx, 4, 17))
}
}
@@ -0,0 +1,18 @@
=== tests/cases/conformance/jsx/tsxAttributeResolution.tsx ===
/// @jsx: preserve
declare namespace JSX {
>JSX : any
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
x: { y: number; z: string; };
>x : { y: number; z: string; }
>y : number
>z : string
}
}
@@ -0,0 +1,53 @@
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(22,8): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(23,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(24,8): error TS2339: Property 'y' does not exist on type 'Attribs1'.
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(25,8): error TS2322: Type 'string' is not assignable to type 'number'.
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(29,1): error TS2324: Property 'reqd' is missing in type '{ reqd: string; }'.
tests/cases/conformance/jsx/tsxAttributeResolution1.tsx(30,8): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution1.tsx (6 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
test2: { reqd: string };
}
}
interface Attribs1 {
x?: number;
s?: string;
}
// OK
<test1 x={0} />; // OK
<test1 />; // OK
<test1 data-x={true} />; // OK
<test2 reqd='true' />; // OK
<test2 reqd={'true'} />; // OK
// Errors
<test1 x={'0'} />; // Error, '0' is not number
~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
<test1 y={0} />; // Error, no property "y"
~
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
<test1 y="foo" />; // Error, no property "y"
~
!!! error TS2339: Property 'y' does not exist on type 'Attribs1'.
<test1 x="32" />; // Error, "32" is not number
~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
// TODO attribute 'var' should be parseable
// <test1 var="10" />; // Error, no 'var' property
<test2 />; // Error, missing reqd
~~~~~~~~~
!!! error TS2324: Property 'reqd' is missing in type '{ reqd: string; }'.
<test2 reqd={10} />; // Error, reqd is not string
~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -0,0 +1,50 @@
//// [tsxAttributeResolution1.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
test2: { reqd: string };
}
}
interface Attribs1 {
x?: number;
s?: string;
}
// OK
<test1 x={0} />; // OK
<test1 />; // OK
<test1 data-x={true} />; // OK
<test2 reqd='true' />; // OK
<test2 reqd={'true'} />; // OK
// Errors
<test1 x={'0'} />; // Error, '0' is not number
<test1 y={0} />; // Error, no property "y"
<test1 y="foo" />; // Error, no property "y"
<test1 x="32" />; // Error, "32" is not number
// TODO attribute 'var' should be parseable
// <test1 var="10" />; // Error, no 'var' property
<test2 />; // Error, missing reqd
<test2 reqd={10} />; // Error, reqd is not string
//// [tsxAttributeResolution1.jsx]
// OK
<test1 x={0}/>; // OK
<test1 />; // OK
<test1 data-x={true}/>; // OK
<test2 reqd='true'/>; // OK
<test2 reqd={'true'}/>; // OK
// Errors
<test1 x={'0'}/>; // Error, '0' is not number
<test1 y={0}/>; // Error, no property "y"
<test1 y="foo"/>; // Error, no property "y"
<test1 x="32"/>; // Error, "32" is not number
// TODO attribute 'var' should be parseable
// <test1 var="10" />; // Error, no 'var' property
<test2 />; // Error, missing reqd
<test2 reqd={10}/>; // Error, reqd is not string
@@ -0,0 +1,24 @@
tests/cases/conformance/jsx/tsxAttributeResolution2.tsx(17,21): error TS2339: Property 'leng' does not exist on type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution2.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
c1?: (x: string) => void;
}
// OK
<test1 c1={(x) => x.length} />; // OK
<test1 data-c1={(x) => x.leng} />; // OK
// Errors
<test1 c1={(x) => x.leng} />; // Error, no leng on 'string'
~~~~
!!! error TS2339: Property 'leng' does not exist on type 'string'.
@@ -0,0 +1,26 @@
//// [tsxAttributeResolution2.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
c1?: (x: string) => void;
}
// OK
<test1 c1={(x) => x.length} />; // OK
<test1 data-c1={(x) => x.leng} />; // OK
// Errors
<test1 c1={(x) => x.leng} />; // Error, no leng on 'string'
//// [tsxAttributeResolution2.jsx]
// OK
<test1 c1={function (x) { return x.length; }}/>; // OK
<test1 data-c1={function (x) { return x.leng; }}/>; // OK
// Errors
<test1 c1={function (x) { return x.leng; }}/>; // Error, no leng on 'string'
@@ -0,0 +1,59 @@
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(19,8): error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(23,1): error TS2324: Property 'x' is missing in type 'Attribs1'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(31,15): error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution3.tsx(39,8): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution3.tsx (4 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
x: string;
y?: number;
z?: string;
}
// OK
var obj1 = { x: 'foo' };
<test1 {...obj1} />
// Error, x is not string
var obj2 = { x: 32 };
<test1 {...obj2} />
~~~~~~~~~
!!! error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// Error, x is missing
var obj3 = { y: 32 };
<test1 {...obj3} />
~~~~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'x' is missing in type 'Attribs1'.
// OK
var obj4 = { x: 32, y: 32 };
<test1 {...obj4} x="ok" />
// Error
var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5} />
~~~~~~~~~
!!! error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
// OK
var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} />
// Error
var obj7 = { x: 'foo' };
<test1 x={32} {...obj7} />
~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
@@ -0,0 +1,64 @@
//// [tsxAttributeResolution3.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
x: string;
y?: number;
z?: string;
}
// OK
var obj1 = { x: 'foo' };
<test1 {...obj1} />
// Error, x is not string
var obj2 = { x: 32 };
<test1 {...obj2} />
// Error, x is missing
var obj3 = { y: 32 };
<test1 {...obj3} />
// OK
var obj4 = { x: 32, y: 32 };
<test1 {...obj4} x="ok" />
// Error
var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5} />
// OK
var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6} />
// Error
var obj7 = { x: 'foo' };
<test1 x={32} {...obj7} />
//// [tsxAttributeResolution3.jsx]
// OK
var obj1 = { x: 'foo' };
<test1 {...obj1}/>;
// Error, x is not string
var obj2 = { x: 32 };
<test1 {...obj2}/>;
// Error, x is missing
var obj3 = { y: 32 };
<test1 {...obj3}/>;
// OK
var obj4 = { x: 32, y: 32 };
<test1 {...obj4} x="ok"/>;
// Error
var obj5 = { x: 32, y: 32 };
<test1 x="ok" {...obj5}/>;
// OK
var obj6 = { x: 'ok', y: 32, extra: 100 };
<test1 {...obj6}/>;
// Error
var obj7 = { x: 'foo' };
<test1 x={32} {...obj7}/>;
@@ -0,0 +1,22 @@
tests/cases/conformance/jsx/tsxAttributeResolution4.tsx(15,26): error TS2339: Property 'len' does not exist on type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution4.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
x(n: string): void;
}
// OK
<test1 {... {x: (n) => 0} } />;
// Error, no member 'len' on 'string'
<test1 {... {x: (n) => n.len} } />;
~~~
!!! error TS2339: Property 'len' does not exist on type 'string'.
@@ -0,0 +1,23 @@
//// [tsxAttributeResolution4.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
}
}
interface Attribs1 {
x(n: string): void;
}
// OK
<test1 {... {x: (n) => 0} } />;
// Error, no member 'len' on 'string'
<test1 {... {x: (n) => n.len} } />;
//// [tsxAttributeResolution4.jsx]
// OK
<test1 {...{ x: function (n) { return 0; } }}/>;
// Error, no member 'len' on 'string'
<test1 {...{ x: function (n) { return n.len; } }}/>;
@@ -0,0 +1,45 @@
tests/cases/conformance/jsx/tsxAttributeResolution5.tsx(21,16): error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
Type 'number' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution5.tsx(25,9): error TS2324: Property 'x' is missing in type 'Attribs1'.
tests/cases/conformance/jsx/tsxAttributeResolution5.tsx(29,1): error TS2324: Property 'x' is missing in type 'Attribs1'.
==== tests/cases/conformance/jsx/tsxAttributeResolution5.tsx (3 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
test2: Attribs2;
}
}
interface Attribs1 {
x: string;
}
interface Attribs2 {
toString(): string;
}
function make1<T extends {x: string}> (obj: T) {
return <test1 {...obj} />; // OK
}
function make2<T extends {x: number}> (obj: T) {
return <test1 {...obj} />; // Error (x is number, not string)
~~~~~~~~
!!! error TS2606: Property 'x' of JSX spread attribute is not assignable to target property.
!!! error TS2606: Type 'number' is not assignable to type 'string'.
}
function make3<T extends {y: string}> (obj: T) {
return <test1 {...obj} />; // Error, missing x
~~~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'x' is missing in type 'Attribs1'.
}
<test1 {...{}} />; // Error, missing x
~~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'x' is missing in type 'Attribs1'.
<test2 {...{}} />; // OK
@@ -0,0 +1,45 @@
//// [tsxAttributeResolution5.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: Attribs1;
test2: Attribs2;
}
}
interface Attribs1 {
x: string;
}
interface Attribs2 {
toString(): string;
}
function make1<T extends {x: string}> (obj: T) {
return <test1 {...obj} />; // OK
}
function make2<T extends {x: number}> (obj: T) {
return <test1 {...obj} />; // Error (x is number, not string)
}
function make3<T extends {y: string}> (obj: T) {
return <test1 {...obj} />; // Error, missing x
}
<test1 {...{}} />; // Error, missing x
<test2 {...{}} />; // OK
//// [tsxAttributeResolution5.jsx]
function make1(obj) {
return <test1 {...obj}/>; // OK
}
function make2(obj) {
return <test1 {...obj}/>; // Error (x is number, not string)
}
function make3(obj) {
return <test1 {...obj}/>; // Error, missing x
}
<test1 {...{}}/>; // Error, missing x
<test2 {...{}}/>; // OK
@@ -0,0 +1,30 @@
tests/cases/conformance/jsx/tsxAttributeResolution6.tsx(10,8): error TS2322: Type 'boolean' is not assignable to type 'string'.
tests/cases/conformance/jsx/tsxAttributeResolution6.tsx(11,8): error TS2322: Type 'string' is not assignable to type 'boolean'.
tests/cases/conformance/jsx/tsxAttributeResolution6.tsx(12,1): error TS2324: Property 'n' is missing in type '{ n: boolean; }'.
==== tests/cases/conformance/jsx/tsxAttributeResolution6.tsx (3 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { n?: boolean; s?: string};
test2: { n: boolean; };
}
}
// Error
<test1 s />;
~
!!! error TS2322: Type 'boolean' is not assignable to type 'string'.
<test1 n='true' />;
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'boolean'.
<test2 />;
~~~~~~~~~
!!! error TS2324: Property 'n' is missing in type '{ n: boolean; }'.
// OK
<test1 n />;
<test1 n={false} />;
<test2 n />;
@@ -0,0 +1,29 @@
//// [tsxAttributeResolution6.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { n?: boolean; s?: string};
test2: { n: boolean; };
}
}
// Error
<test1 s />;
<test1 n='true' />;
<test2 />;
// OK
<test1 n />;
<test1 n={false} />;
<test2 n />;
//// [tsxAttributeResolution6.jsx]
// Error
<test1 s=/>;
<test1 n='true'/>;
<test2 />;
// OK
<test1 n=/>;
<test1 n={false}/>;
<test2 n=/>;
@@ -0,0 +1,21 @@
tests/cases/conformance/jsx/tsxAttributeResolution7.tsx(9,8): error TS2322: Type 'number' is not assignable to type 'string'.
==== tests/cases/conformance/jsx/tsxAttributeResolution7.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { "data-foo"?: string };
}
}
// Error
<test1 data-foo={32} />;
~~~~~~~~~~~~~
!!! error TS2322: Type 'number' is not assignable to type 'string'.
// OK
<test1 data-foo={'32'} />;
<test1 data-bar={'32'} />;
<test1 data-bar={32} />;
@@ -0,0 +1,24 @@
//// [tsxAttributeResolution7.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
test1: { "data-foo"?: string };
}
}
// Error
<test1 data-foo={32} />;
// OK
<test1 data-foo={'32'} />;
<test1 data-bar={'32'} />;
<test1 data-bar={32} />;
//// [tsxAttributeResolution7.jsx]
// Error
<test1 data-foo={32}/>;
// OK
<test1 data-foo={'32'}/>;
<test1 data-bar={'32'}/>;
<test1 data-bar={32}/>;
@@ -0,0 +1,40 @@
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.
@@ -0,0 +1,55 @@
//// [tsxElementResolution.tsx]
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" />;
var b = <string_named />;
// TODO: This should not be a parse error (should
// parse a property name here, not identifier)
// var c = <var />;
var d = <Other />;
var e = <Dotted.Name />;
//// [tsxElementResolution.jsx]
var foundFirst = (function () {
function foundFirst() {
}
return foundFirst;
})();
var Other = (function () {
function Other() {
}
return Other;
})();
var Dotted;
(function (Dotted) {
var Name = (function () {
function Name() {
}
return Name;
})();
Dotted.Name = Name;
})(Dotted || (Dotted = {}));
// Should find the intrinsic element, not the class element
var a = <foundFirst x="hello"/>;
var b = <string_named />;
// TODO: This should not be a parse error (should
// parse a property name here, not identifier)
// var c = <var />;
var d = <Other />;
var e = <Dotted.Name />;
@@ -0,0 +1,18 @@
tests/cases/conformance/jsx/tsxElementResolution1.tsx(12,1): error TS2339: Property 'span' does not exist on type 'JSX.IntrinsicElements'.
==== tests/cases/conformance/jsx/tsxElementResolution1.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
div: any
}
}
// OK
<div />;
// Fail
<span />;
~~~~~~~~
!!! error TS2339: Property 'span' does not exist on type 'JSX.IntrinsicElements'.
@@ -0,0 +1,19 @@
//// [tsxElementResolution1.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
div: any
}
}
// OK
<div />;
// Fail
<span />;
//// [tsxElementResolution1.jsx]
// OK
<div />;
// Fail
<span />;
@@ -0,0 +1,28 @@
tests/cases/conformance/jsx/tsxElementResolution10.tsx(13,1): error TS2605: JSX element '{ x: number; }' is not a constructor function for JSX elements.
Property 'render' is missing in type '{ x: number; }'.
==== tests/cases/conformance/jsx/tsxElementResolution10.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface ElementClass {
render: any;
}
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): { x: number };
}
var Obj1: Obj1type;
<Obj1 x={10} />; // Error, no render member
~~~~~~~~~~~~~~~
!!! error TS2605: JSX element '{ x: number; }' is not a constructor function for JSX elements.
!!! error TS2605: Property 'render' is missing in type '{ x: number; }'.
interface Obj2type {
(n: string): { x: number; render: any; };
}
var Obj2: Obj2type;
<Obj2 x={32} render={100} />; // OK
@@ -0,0 +1,27 @@
//// [tsxElementResolution10.tsx]
declare module JSX {
interface Element { }
interface ElementClass {
render: any;
}
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): { x: number };
}
var Obj1: Obj1type;
<Obj1 x={10} />; // Error, no render member
interface Obj2type {
(n: string): { x: number; render: any; };
}
var Obj2: Obj2type;
<Obj2 x={32} render={100} />; // OK
//// [tsxElementResolution10.jsx]
var Obj1;
<Obj1 x={10}/>; // Error, no render member
var Obj2;
<Obj2 x={32} render={100}/>; // OK
@@ -0,0 +1,30 @@
tests/cases/conformance/jsx/tsxElementResolution11.tsx(17,7): error TS2339: Property 'x' does not exist on type '{ q?: number; }'.
==== tests/cases/conformance/jsx/tsxElementResolution11.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface ElementAttributesProperty { }
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): any;
}
var Obj1: Obj1type;
<Obj1 x={10} />; // OK
interface Obj2type {
new(n: string): { q?: number };
}
var Obj2: Obj2type;
<Obj2 x={10} />; // Error
~
!!! error TS2339: Property 'x' does not exist on type '{ q?: number; }'.
interface Obj3type {
new(n: string): { x: number; };
}
var Obj3: Obj3type;
<Obj3 x={10} />; // OK
@@ -0,0 +1,33 @@
//// [tsxElementResolution11.tsx]
declare module JSX {
interface Element { }
interface ElementAttributesProperty { }
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): any;
}
var Obj1: Obj1type;
<Obj1 x={10} />; // OK
interface Obj2type {
new(n: string): { q?: number };
}
var Obj2: Obj2type;
<Obj2 x={10} />; // Error
interface Obj3type {
new(n: string): { x: number; };
}
var Obj3: Obj3type;
<Obj3 x={10} />; // OK
//// [tsxElementResolution11.jsx]
var Obj1;
<Obj1 x={10}/>; // OK
var Obj2;
<Obj2 x={10}/>; // Error
var Obj3;
<Obj3 x={10}/>; // OK
@@ -0,0 +1,43 @@
tests/cases/conformance/jsx/tsxElementResolution12.tsx(17,2): error TS2304: Cannot find name 'Obj2'.
tests/cases/conformance/jsx/tsxElementResolution12.tsx(23,1): error TS2607: JSX element class does not support attributes because it does not have a 'pr' property
tests/cases/conformance/jsx/tsxElementResolution12.tsx(30,7): error TS2322: Type 'string' is not assignable to type 'number'.
==== tests/cases/conformance/jsx/tsxElementResolution12.tsx (3 errors) ====
declare module JSX {
interface Element { }
interface ElementAttributesProperty { pr: any; }
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): any;
}
var Obj1: Obj1type;
<Obj1 x={10} />; // OK
interface Obj2type {
new(n: string): { q?: number; pr: any };
}
var obj2: Obj2type;
<Obj2 x={10} />; // OK
~~~~
!!! error TS2304: Cannot find name 'Obj2'.
interface Obj3type {
new(n: string): { x: number; };
}
var Obj3: Obj3type;
<Obj3 x={10} />; // Error
~~~~~~~~~~~~~~~
!!! error TS2607: JSX element class does not support attributes because it does not have a 'pr' property
interface Obj4type {
new(n: string): { x: number; pr: { x: number; } };
}
var Obj4: Obj4type;
<Obj4 x={10} />; // OK
<Obj4 x={'10'} />; // Error
~~~~~~~~
!!! error TS2322: Type 'string' is not assignable to type 'number'.
@@ -0,0 +1,43 @@
//// [tsxElementResolution12.tsx]
declare module JSX {
interface Element { }
interface ElementAttributesProperty { pr: any; }
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): any;
}
var Obj1: Obj1type;
<Obj1 x={10} />; // OK
interface Obj2type {
new(n: string): { q?: number; pr: any };
}
var obj2: Obj2type;
<Obj2 x={10} />; // OK
interface Obj3type {
new(n: string): { x: number; };
}
var Obj3: Obj3type;
<Obj3 x={10} />; // Error
interface Obj4type {
new(n: string): { x: number; pr: { x: number; } };
}
var Obj4: Obj4type;
<Obj4 x={10} />; // OK
<Obj4 x={'10'} />; // Error
//// [tsxElementResolution12.jsx]
var Obj1;
<Obj1 x={10}/>; // OK
var obj2;
<Obj2 x={10}/>; // OK
var Obj3;
<Obj3 x={10}/>; // Error
var Obj4;
<Obj4 x={10}/>; // OK
<Obj4 x={'10'}/>; // Error
@@ -0,0 +1,16 @@
//// [tsxElementResolution13.tsx]
declare module JSX {
interface Element { }
interface ElementAttributesProperty { pr1: any; pr2: any; }
}
interface Obj1 {
new(n: string): any;
}
var obj1: Obj1;
<obj1 x={10} />; // Error
//// [tsxElementResolution13.jsx]
var obj1;
<obj1 x={10}/>; // Error
@@ -0,0 +1,26 @@
=== tests/cases/conformance/jsx/tsxElementResolution13.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution13.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxElementResolution13.tsx, 0, 20))
interface ElementAttributesProperty { pr1: any; pr2: any; }
>ElementAttributesProperty : Symbol(ElementAttributesProperty, Decl(tsxElementResolution13.tsx, 1, 22))
>pr1 : Symbol(pr1, Decl(tsxElementResolution13.tsx, 2, 38))
>pr2 : Symbol(pr2, Decl(tsxElementResolution13.tsx, 2, 48))
}
interface Obj1 {
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution13.tsx, 3, 1))
new(n: string): any;
>n : Symbol(n, Decl(tsxElementResolution13.tsx, 6, 5))
}
var obj1: Obj1;
>obj1 : Symbol(obj1, Decl(tsxElementResolution13.tsx, 8, 3))
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution13.tsx, 3, 1))
<obj1 x={10} />; // Error
>x : Symbol(unknown)
@@ -0,0 +1,28 @@
=== tests/cases/conformance/jsx/tsxElementResolution13.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface ElementAttributesProperty { pr1: any; pr2: any; }
>ElementAttributesProperty : ElementAttributesProperty
>pr1 : any
>pr2 : any
}
interface Obj1 {
>Obj1 : Obj1
new(n: string): any;
>n : string
}
var obj1: Obj1;
>obj1 : Obj1
>Obj1 : Obj1
<obj1 x={10} />; // Error
><obj1 x={10} /> : JSX.Element
>obj1 : Obj1
>x : any
@@ -0,0 +1,15 @@
//// [tsxElementResolution14.tsx]
declare module JSX {
interface Element { }
}
interface Obj1 {
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // OK
//// [tsxElementResolution14.jsx]
var obj1;
<obj1 x={10}/>; // OK
@@ -0,0 +1,21 @@
=== tests/cases/conformance/jsx/tsxElementResolution14.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution14.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxElementResolution14.tsx, 0, 20))
}
interface Obj1 {
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution14.tsx, 2, 1))
new(n: string): {};
>n : Symbol(n, Decl(tsxElementResolution14.tsx, 5, 5))
}
var obj1: Obj1;
>obj1 : Symbol(obj1, Decl(tsxElementResolution14.tsx, 7, 3))
>Obj1 : Symbol(Obj1, Decl(tsxElementResolution14.tsx, 2, 1))
<obj1 x={10} />; // OK
>x : Symbol(unknown)
@@ -0,0 +1,23 @@
=== tests/cases/conformance/jsx/tsxElementResolution14.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
}
interface Obj1 {
>Obj1 : Obj1
new(n: string): {};
>n : string
}
var obj1: Obj1;
>obj1 : Obj1
>Obj1 : Obj1
<obj1 x={10} />; // OK
><obj1 x={10} /> : JSX.Element
>obj1 : Obj1
>x : any
@@ -0,0 +1,18 @@
tests/cases/conformance/jsx/tsxElementResolution15.tsx(3,12): error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property
==== tests/cases/conformance/jsx/tsxElementResolution15.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface ElementAttributesProperty { pr1: any; pr2: any; }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2608: The global type 'JSX.ElementAttributesProperty' may not have more than one property
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): {};
}
var Obj1: Obj1type;
<Obj1 x={10} />; // Error
@@ -0,0 +1,17 @@
//// [tsxElementResolution15.tsx]
declare module JSX {
interface Element { }
interface ElementAttributesProperty { pr1: any; pr2: any; }
interface IntrinsicElements { }
}
interface Obj1type {
new(n: string): {};
}
var Obj1: Obj1type;
<Obj1 x={10} />; // Error
//// [tsxElementResolution15.jsx]
var Obj1;
<Obj1 x={10}/>; // Error
@@ -0,0 +1,15 @@
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 (1 errors) ====
declare module JSX {
}
interface Obj1 {
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // Error (JSX.Element is missing)
~~~~~~~~~~~~~~~
!!! error TS2602: The global type 'JSX.Element' must exist when using JSX.
@@ -0,0 +1,14 @@
//// [tsxElementResolution16.tsx]
declare module JSX {
}
interface Obj1 {
new(n: string): {};
}
var obj1: Obj1;
<obj1 x={10} />; // Error (JSX.Element is missing)
//// [tsxElementResolution16.jsx]
var obj1;
<obj1 x={10}/>; // Error (JSX.Element is missing)
@@ -0,0 +1,34 @@
//// [tests/cases/conformance/jsx/tsxElementResolution17.tsx] ////
//// [file.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
declare module 'elements1' {
class MyElement {
}
}
declare module 'elements2' {
class MyElement {
}
}
//// [consumer.tsx]
///<reference path="file.tsx" />
// Should keep s1 and elide s2
import s1 = require('elements1');
import s2 = require('elements2');
<s1.MyElement />;
//// [file.jsx]
//// [consumer.jsx]
define(["require", "exports", 'elements1'], function (require, exports, s1) {
<s1.MyElement />;
});
@@ -0,0 +1,38 @@
=== tests/cases/conformance/jsx/consumer.tsx ===
///<reference path="file.tsx" />
// Should keep s1 and elide s2
import s1 = require('elements1');
>s1 : Symbol(s1, Decl(consumer.tsx, 0, 0))
import s2 = require('elements2');
>s2 : Symbol(s2, Decl(consumer.tsx, 2, 33))
<s1.MyElement />;
>MyElement : Symbol(s1.MyElement, Decl(file.tsx, 6, 28))
=== tests/cases/conformance/jsx/file.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(file.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(file.tsx, 1, 20))
interface IntrinsicElements { }
>IntrinsicElements : Symbol(IntrinsicElements, Decl(file.tsx, 2, 22))
}
declare module 'elements1' {
class MyElement {
>MyElement : Symbol(MyElement, Decl(file.tsx, 6, 28))
}
}
declare module 'elements2' {
class MyElement {
>MyElement : Symbol(MyElement, Decl(file.tsx, 12, 28))
}
}
@@ -0,0 +1,40 @@
=== tests/cases/conformance/jsx/consumer.tsx ===
///<reference path="file.tsx" />
// Should keep s1 and elide s2
import s1 = require('elements1');
>s1 : typeof s1
import s2 = require('elements2');
>s2 : typeof s2
<s1.MyElement />;
><s1.MyElement /> : JSX.Element
>s1 : any
>MyElement : any
=== tests/cases/conformance/jsx/file.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements { }
>IntrinsicElements : IntrinsicElements
}
declare module 'elements1' {
class MyElement {
>MyElement : MyElement
}
}
declare module 'elements2' {
class MyElement {
>MyElement : MyElement
}
}
@@ -0,0 +1,13 @@
tests/cases/conformance/jsx/tsxElementResolution18.tsx(6,1): error TS2609: JSX element implicitly has type 'any' because no interface JSX.IntrinsicElements exists
==== tests/cases/conformance/jsx/tsxElementResolution18.tsx (1 errors) ====
declare module JSX {
interface Element { }
}
// Error under implicit any
<div n='x' />;
~~~~~~~~~~~~~
!!! error TS2609: JSX element implicitly has type 'any' because no interface JSX.IntrinsicElements exists
@@ -0,0 +1,12 @@
//// [tsxElementResolution18.tsx]
declare module JSX {
interface Element { }
}
// Error under implicit any
<div n='x' />;
//// [tsxElementResolution18.jsx]
// Error under implicit any
<div n='x'/>;
@@ -0,0 +1,19 @@
//// [tsxElementResolution2.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[x: string]: any;
}
}
// OK
<div />;
// OK
<span />;
//// [tsxElementResolution2.jsx]
// OK
<div />;
// OK
<span />;
@@ -0,0 +1,23 @@
=== tests/cases/conformance/jsx/tsxElementResolution2.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution2.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxElementResolution2.tsx, 0, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxElementResolution2.tsx, 1, 22))
[x: string]: any;
>x : Symbol(x, Decl(tsxElementResolution2.tsx, 3, 6))
}
}
// OK
<div />;
>div : Symbol(JSX.IntrinsicElements, Decl(tsxElementResolution2.tsx, 1, 22))
// OK
<span />;
>span : Symbol(JSX.IntrinsicElements, Decl(tsxElementResolution2.tsx, 1, 22))
@@ -0,0 +1,25 @@
=== tests/cases/conformance/jsx/tsxElementResolution2.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[x: string]: any;
>x : string
}
}
// OK
<div />;
><div /> : JSX.Element
>div : any
// OK
<span />;
><span /> : JSX.Element
>span : any
@@ -0,0 +1,21 @@
tests/cases/conformance/jsx/tsxElementResolution3.tsx(12,1): error TS2324: Property 'n' is missing in type '{ n: string; }'.
tests/cases/conformance/jsx/tsxElementResolution3.tsx(12,7): error TS2339: Property 'w' does not exist on type '{ n: string; }'.
==== tests/cases/conformance/jsx/tsxElementResolution3.tsx (2 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
[x: string]: { n: string; };
}
}
// OK
<div n='x' />;
// Error
<span w='err' />;
~~~~~~~~~~~~~~~~
!!! error TS2324: Property 'n' is missing in type '{ n: string; }'.
~
!!! error TS2339: Property 'w' does not exist on type '{ n: string; }'.
@@ -0,0 +1,19 @@
//// [tsxElementResolution3.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[x: string]: { n: string; };
}
}
// OK
<div n='x' />;
// Error
<span w='err' />;
//// [tsxElementResolution3.jsx]
// OK
<div n='x'/>;
// Error
<span w='err'/>;
@@ -0,0 +1,26 @@
tests/cases/conformance/jsx/tsxElementResolution4.tsx(16,1): error TS2324: Property 'm' is missing in type '{ m: string; }'.
tests/cases/conformance/jsx/tsxElementResolution4.tsx(16,7): error TS2339: Property 'q' does not exist on type '{ m: string; }'.
==== tests/cases/conformance/jsx/tsxElementResolution4.tsx (2 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements {
div: { n: string; };
span: { m: string; };
}
}
// OK
<div n='x' />;
// OK
<span m='ok' />;
// Error
<span q='' />;
~~~~~~~~~~~~~
!!! error TS2324: Property 'm' is missing in type '{ m: string; }'.
~
!!! error TS2339: Property 'q' does not exist on type '{ m: string; }'.
@@ -0,0 +1,26 @@
//// [tsxElementResolution4.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
div: { n: string; };
span: { m: string; };
}
}
// OK
<div n='x' />;
// OK
<span m='ok' />;
// Error
<span q='' />;
//// [tsxElementResolution4.jsx]
// OK
<div n='x'/>;
// OK
<span m='ok'/>;
// Error
<span q=''/>;
@@ -0,0 +1,12 @@
//// [tsxElementResolution5.tsx]
declare module JSX {
interface Element { }
}
// OK, but implicit any
<div n='x' />;
//// [tsxElementResolution5.jsx]
// OK, but implicit any
<div n='x'/>;
@@ -0,0 +1,12 @@
=== tests/cases/conformance/jsx/tsxElementResolution5.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxElementResolution5.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxElementResolution5.tsx, 0, 20))
}
// OK, but implicit any
<div n='x' />;
>n : Symbol(unknown)
@@ -0,0 +1,14 @@
=== tests/cases/conformance/jsx/tsxElementResolution5.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
}
// OK, but implicit any
<div n='x' />;
><div n='x' /> : JSX.Element
>div : any
>n : any
@@ -0,0 +1,15 @@
tests/cases/conformance/jsx/tsxElementResolution6.tsx(8,1): error TS2339: Property 'div' does not exist on type 'JSX.IntrinsicElements'.
==== tests/cases/conformance/jsx/tsxElementResolution6.tsx (1 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
var div: any;
// Still an error
<div n='x' />;
~~~~~~~~~~~~~
!!! error TS2339: Property 'div' does not exist on type 'JSX.IntrinsicElements'.
@@ -0,0 +1,15 @@
//// [tsxElementResolution6.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
var div: any;
// Still an error
<div n='x' />;
//// [tsxElementResolution6.jsx]
var div;
// Still an error
<div n='x'/>;
@@ -0,0 +1,30 @@
tests/cases/conformance/jsx/tsxElementResolution7.tsx(12,5): error TS2339: Property 'other' does not exist on type 'typeof my'.
tests/cases/conformance/jsx/tsxElementResolution7.tsx(19,11): error TS2339: Property 'non' does not exist on type 'typeof my'.
==== tests/cases/conformance/jsx/tsxElementResolution7.tsx (2 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
module my {
export var div: any;
}
// OK
<my.div n='x' />;
// Error
<my.other />;
~~~~~
!!! error TS2339: Property 'other' does not exist on type 'typeof my'.
module q {
import mine = my;
// OK
<mine.div n='x' />;
// Error
<mine.non />;
~~~
!!! error TS2339: Property 'non' does not exist on type 'typeof my'.
}
@@ -0,0 +1,39 @@
//// [tsxElementResolution7.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
module my {
export var div: any;
}
// OK
<my.div n='x' />;
// Error
<my.other />;
module q {
import mine = my;
// OK
<mine.div n='x' />;
// Error
<mine.non />;
}
//// [tsxElementResolution7.jsx]
var my;
(function (my) {
})(my || (my = {}));
// OK
<my.div n='x'/>;
// Error
<my.other />;
var q;
(function (q) {
var mine = my;
// OK
<mine.div n='x'/>;
// Error
<mine.non />;
})(q || (q = {}));
@@ -0,0 +1,50 @@
tests/cases/conformance/jsx/tsxElementResolution8.tsx(8,2): error TS2604: JSX element 'Div' is not a constructor function.
tests/cases/conformance/jsx/tsxElementResolution8.tsx(16,2): error TS2601: The return type of a JSX element constructor must return an object type.
tests/cases/conformance/jsx/tsxElementResolution8.tsx(29,2): error TS2601: The return type of a JSX element constructor must return an object type.
tests/cases/conformance/jsx/tsxElementResolution8.tsx(34,2): error TS2604: JSX element 'Obj3' is not a constructor function.
==== tests/cases/conformance/jsx/tsxElementResolution8.tsx (4 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
// Error
var Div = 3;
<Div />;
~~~
!!! error TS2604: JSX element 'Div' is not a constructor function.
// OK
function Fact(): any { return null; }
<Fact />
// Error
function Fnum(): number{ return 42; }
<Fnum />
~~~~
!!! error TS2601: The return type of a JSX element constructor must return an object type.
interface Obj1 {
new(): {};
(): number;
}
var Obj1: Obj1;
<Obj1 />; // OK, prefer construct signatures
interface Obj2 {
(): number;
}
var Obj2: Obj2;
<Obj2 />; // Error
~~~~
!!! error TS2601: The return type of a JSX element constructor must return an object type.
interface Obj3 {
}
var Obj3: Obj3;
<Obj3 />; // Error
~~~~
!!! error TS2604: JSX element 'Obj3' is not a constructor function.
@@ -0,0 +1,53 @@
//// [tsxElementResolution8.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
// Error
var Div = 3;
<Div />;
// OK
function Fact(): any { return null; }
<Fact />
// Error
function Fnum(): number{ return 42; }
<Fnum />
interface Obj1 {
new(): {};
(): number;
}
var Obj1: Obj1;
<Obj1 />; // OK, prefer construct signatures
interface Obj2 {
(): number;
}
var Obj2: Obj2;
<Obj2 />; // Error
interface Obj3 {
}
var Obj3: Obj3;
<Obj3 />; // Error
//// [tsxElementResolution8.jsx]
// Error
var Div = 3;
<Div />;
// OK
function Fact() { return null; }
<Fact />;
// Error
function Fnum() { return 42; }
<Fnum />;
var Obj1;
<Obj1 />; // OK, prefer construct signatures
var Obj2;
<Obj2 />; // Error
var Obj3;
<Obj3 />; // Error
@@ -0,0 +1,35 @@
tests/cases/conformance/jsx/tsxElementResolution9.tsx(11,2): error TS2601: The return type of a JSX element constructor must return an object type.
tests/cases/conformance/jsx/tsxElementResolution9.tsx(18,2): error TS2601: The return type of a JSX element constructor must return an object type.
==== tests/cases/conformance/jsx/tsxElementResolution9.tsx (2 errors) ====
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
interface Obj1 {
new(n: string): { x: number };
new(n: number): { y: string };
}
var Obj1: Obj1;
<Obj1 />; // Error, return type is not an object type
~~~~
!!! error TS2601: The return type of a JSX element constructor must return an object type.
interface Obj2 {
(n: string): { x: number };
(n: number): { y: string };
}
var Obj2: Obj2;
<Obj2 />; // Error, return type is not an object type
~~~~
!!! error TS2601: The return type of a JSX element constructor must return an object type.
interface Obj3 {
(n: string): { x: number };
(n: number): { x: number; y: string };
}
var Obj3: Obj3;
<Obj3 x={42} />; // OK
@@ -0,0 +1,35 @@
//// [tsxElementResolution9.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
interface Obj1 {
new(n: string): { x: number };
new(n: number): { y: string };
}
var Obj1: Obj1;
<Obj1 />; // Error, return type is not an object type
interface Obj2 {
(n: string): { x: number };
(n: number): { y: string };
}
var Obj2: Obj2;
<Obj2 />; // Error, return type is not an object type
interface Obj3 {
(n: string): { x: number };
(n: number): { x: number; y: string };
}
var Obj3: Obj3;
<Obj3 x={42} />; // OK
//// [tsxElementResolution9.jsx]
var Obj1;
<Obj1 />; // Error, return type is not an object type
var Obj2;
<Obj2 />; // Error, return type is not an object type
var Obj3;
<Obj3 x={42}/>; // OK
+75
View File
@@ -0,0 +1,75 @@
//// [tsxEmit1.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
var p;
var selfClosed1 = <div />;
var selfClosed2 = <div x="1" />;
var selfClosed3 = <div x='1' />;
var selfClosed4 = <div x="1" y='0' />;
var selfClosed5 = <div x={0} y='0' />;
var selfClosed6 = <div x={"1"} y='0' />;
var selfClosed7 = <div x={p} y='p' />;
var openClosed1 = <div></div>;
var openClosed2 = <div n='m'>foo</div>;
var openClosed3 = <div n='m'>{p}</div>;
var openClosed4 = <div n='m'>{p < p}</div>;
var openClosed5 = <div n='m'>{p > p}</div>;
class SomeClass {
f() {
var rewrites1 = <div>{() => this}</div>;
var rewrites2 = <div>{[p, ...p, p]}</div>;
var rewrites3 = <div>{{p}}</div>;
var rewrites4 = <div a={() => this}></div>;
var rewrites5 = <div a={[p, ...p, p]}></div>;
var rewrites6 = <div a={{p}}></div>;
}
}
var whitespace1 = <div> </div>;
var whitespace2 = <div> {p} </div>;
var whitespace3 = <div>
{p}
</div>;
//// [tsxEmit1.jsx]
var p;
var selfClosed1 = <div />;
var selfClosed2 = <div x="1"/>;
var selfClosed3 = <div x='1'/>;
var selfClosed4 = <div x="1" y='0'/>;
var selfClosed5 = <div x={0} y='0'/>;
var selfClosed6 = <div x={"1"} y='0'/>;
var selfClosed7 = <div x={p} y='p'/>;
var openClosed1 = <div></div>;
var openClosed2 = <div n='m'>foo</div>;
var openClosed3 = <div n='m'>{p}</div>;
var openClosed4 = <div n='m'>{p < p}</div>;
var openClosed5 = <div n='m'>{p > p}</div>;
var SomeClass = (function () {
function SomeClass() {
}
SomeClass.prototype.f = function () {
var _this = this;
var rewrites1 = <div>{function () { return _this; }}</div>;
var rewrites2 = <div>{[p].concat(p, [p])}</div>;
var rewrites3 = <div>{{ p: p }}</div>;
var rewrites4 = <div a={function () { return _this; }}></div>;
var rewrites5 = <div a={[p].concat(p, [p])}></div>;
var rewrites6 = <div a={{ p: p }}></div>;
};
return SomeClass;
})();
var whitespace1 = <div> </div>;
var whitespace2 = <div> {p} </div>;
var whitespace3 = <div>
{p}
</div>;
+144
View File
@@ -0,0 +1,144 @@
=== tests/cases/conformance/jsx/tsxEmit1.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxEmit1.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxEmit1.tsx, 0, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
[s: string]: any;
>s : Symbol(s, Decl(tsxEmit1.tsx, 3, 3))
}
}
var p;
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
var selfClosed1 = <div />;
>selfClosed1 : Symbol(selfClosed1, Decl(tsxEmit1.tsx, 8, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var selfClosed2 = <div x="1" />;
>selfClosed2 : Symbol(selfClosed2, Decl(tsxEmit1.tsx, 9, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
var selfClosed3 = <div x='1' />;
>selfClosed3 : Symbol(selfClosed3, Decl(tsxEmit1.tsx, 10, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
var selfClosed4 = <div x="1" y='0' />;
>selfClosed4 : Symbol(selfClosed4, Decl(tsxEmit1.tsx, 11, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>y : Symbol(unknown)
var selfClosed5 = <div x={0} y='0' />;
>selfClosed5 : Symbol(selfClosed5, Decl(tsxEmit1.tsx, 12, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>y : Symbol(unknown)
var selfClosed6 = <div x={"1"} y='0' />;
>selfClosed6 : Symbol(selfClosed6, Decl(tsxEmit1.tsx, 13, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>y : Symbol(unknown)
var selfClosed7 = <div x={p} y='p' />;
>selfClosed7 : Symbol(selfClosed7, Decl(tsxEmit1.tsx, 14, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>x : Symbol(unknown)
>y : Symbol(unknown)
var openClosed1 = <div></div>;
>openClosed1 : Symbol(openClosed1, Decl(tsxEmit1.tsx, 16, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var openClosed2 = <div n='m'>foo</div>;
>openClosed2 : Symbol(openClosed2, Decl(tsxEmit1.tsx, 17, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>n : Symbol(unknown)
var openClosed3 = <div n='m'>{p}</div>;
>openClosed3 : Symbol(openClosed3, Decl(tsxEmit1.tsx, 18, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>n : Symbol(unknown)
var openClosed4 = <div n='m'>{p < p}</div>;
>openClosed4 : Symbol(openClosed4, Decl(tsxEmit1.tsx, 19, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>n : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
var openClosed5 = <div n='m'>{p > p}</div>;
>openClosed5 : Symbol(openClosed5, Decl(tsxEmit1.tsx, 20, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>n : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
class SomeClass {
>SomeClass : Symbol(SomeClass, Decl(tsxEmit1.tsx, 20, 43))
f() {
>f : Symbol(f, Decl(tsxEmit1.tsx, 22, 17))
var rewrites1 = <div>{() => this}</div>;
>rewrites1 : Symbol(rewrites1, Decl(tsxEmit1.tsx, 24, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>this : Symbol(SomeClass, Decl(tsxEmit1.tsx, 20, 43))
var rewrites2 = <div>{[p, ...p, p]}</div>;
>rewrites2 : Symbol(rewrites2, Decl(tsxEmit1.tsx, 25, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
var rewrites3 = <div>{{p}}</div>;
>rewrites3 : Symbol(rewrites3, Decl(tsxEmit1.tsx, 26, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>p : Symbol(p, Decl(tsxEmit1.tsx, 26, 25))
var rewrites4 = <div a={() => this}></div>;
>rewrites4 : Symbol(rewrites4, Decl(tsxEmit1.tsx, 28, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>a : Symbol(unknown)
>this : Symbol(SomeClass, Decl(tsxEmit1.tsx, 20, 43))
var rewrites5 = <div a={[p, ...p, p]}></div>;
>rewrites5 : Symbol(rewrites5, Decl(tsxEmit1.tsx, 29, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>a : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
>p : Symbol(p, Decl(tsxEmit1.tsx, 7, 3))
var rewrites6 = <div a={{p}}></div>;
>rewrites6 : Symbol(rewrites6, Decl(tsxEmit1.tsx, 30, 5))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
>a : Symbol(unknown)
>p : Symbol(p, Decl(tsxEmit1.tsx, 30, 27))
}
}
var whitespace1 = <div> </div>;
>whitespace1 : Symbol(whitespace1, Decl(tsxEmit1.tsx, 34, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var whitespace2 = <div> {p} </div>;
>whitespace2 : Symbol(whitespace2, Decl(tsxEmit1.tsx, 35, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
var whitespace3 = <div>
>whitespace3 : Symbol(whitespace3, Decl(tsxEmit1.tsx, 36, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit1.tsx, 1, 22))
{p}
</div>;
+194
View File
@@ -0,0 +1,194 @@
=== tests/cases/conformance/jsx/tsxEmit1.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[s: string]: any;
>s : string
}
}
var p;
>p : any
var selfClosed1 = <div />;
>selfClosed1 : JSX.Element
><div /> : JSX.Element
>div : any
var selfClosed2 = <div x="1" />;
>selfClosed2 : JSX.Element
><div x="1" /> : JSX.Element
>div : any
>x : any
var selfClosed3 = <div x='1' />;
>selfClosed3 : JSX.Element
><div x='1' /> : JSX.Element
>div : any
>x : any
var selfClosed4 = <div x="1" y='0' />;
>selfClosed4 : JSX.Element
><div x="1" y='0' /> : JSX.Element
>div : any
>x : any
>y : any
var selfClosed5 = <div x={0} y='0' />;
>selfClosed5 : JSX.Element
><div x={0} y='0' /> : JSX.Element
>div : any
>x : any
>y : any
var selfClosed6 = <div x={"1"} y='0' />;
>selfClosed6 : JSX.Element
><div x={"1"} y='0' /> : JSX.Element
>div : any
>x : any
>y : any
var selfClosed7 = <div x={p} y='p' />;
>selfClosed7 : JSX.Element
><div x={p} y='p' /> : JSX.Element
>div : any
>x : any
>p : any
>y : any
var openClosed1 = <div></div>;
>openClosed1 : JSX.Element
><div></div> : JSX.Element
>div : any
>div : any
var openClosed2 = <div n='m'>foo</div>;
>openClosed2 : JSX.Element
><div n='m'>foo</div> : JSX.Element
>div : any
>n : any
>div : any
var openClosed3 = <div n='m'>{p}</div>;
>openClosed3 : JSX.Element
><div n='m'>{p}</div> : JSX.Element
>div : any
>n : any
>p : any
>div : any
var openClosed4 = <div n='m'>{p < p}</div>;
>openClosed4 : JSX.Element
><div n='m'>{p < p}</div> : JSX.Element
>div : any
>n : any
>p < p : boolean
>p : any
>p : any
>div : any
var openClosed5 = <div n='m'>{p > p}</div>;
>openClosed5 : JSX.Element
><div n='m'>{p > p}</div> : JSX.Element
>div : any
>n : any
>p > p : boolean
>p : any
>p : any
>div : any
class SomeClass {
>SomeClass : SomeClass
f() {
>f : () => void
var rewrites1 = <div>{() => this}</div>;
>rewrites1 : JSX.Element
><div>{() => this}</div> : JSX.Element
>div : any
>() => this : () => SomeClass
>this : SomeClass
>div : any
var rewrites2 = <div>{[p, ...p, p]}</div>;
>rewrites2 : JSX.Element
><div>{[p, ...p, p]}</div> : JSX.Element
>div : any
>[p, ...p, p] : any[]
>p : any
>...p : any
>p : any
>p : any
>div : any
var rewrites3 = <div>{{p}}</div>;
>rewrites3 : JSX.Element
><div>{{p}}</div> : JSX.Element
>div : any
>{p} : { p: any; }
>p : any
>div : any
var rewrites4 = <div a={() => this}></div>;
>rewrites4 : JSX.Element
><div a={() => this}></div> : JSX.Element
>div : any
>a : any
>() => this : () => SomeClass
>this : SomeClass
>div : any
var rewrites5 = <div a={[p, ...p, p]}></div>;
>rewrites5 : JSX.Element
><div a={[p, ...p, p]}></div> : JSX.Element
>div : any
>a : any
>[p, ...p, p] : any[]
>p : any
>...p : any
>p : any
>p : any
>div : any
var rewrites6 = <div a={{p}}></div>;
>rewrites6 : JSX.Element
><div a={{p}}></div> : JSX.Element
>div : any
>a : any
>{p} : { p: any; }
>p : any
>div : any
}
}
var whitespace1 = <div> </div>;
>whitespace1 : JSX.Element
><div> </div> : JSX.Element
>div : any
>div : any
var whitespace2 = <div> {p} </div>;
>whitespace2 : JSX.Element
><div> {p} </div> : JSX.Element
>div : any
>p : any
>div : any
var whitespace3 = <div>
>whitespace3 : JSX.Element
><div> {p} </div> : JSX.Element
>div : any
{p}
>p : any
</div>;
>div : any
+23
View File
@@ -0,0 +1,23 @@
//// [tsxEmit2.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements {
[s: string]: any;
}
}
var p1, p2, p3;
var spreads1 = <div {...p1}>{p2}</div>;
var spreads2 = <div {...p1}>{p2}</div>;
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
var spreads4 = <div {...p1} x={p3} >{p2}</div>;
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
//// [tsxEmit2.jsx]
var p1, p2, p3;
var spreads1 = <div {...p1}>{p2}</div>;
var spreads2 = <div {...p1}>{p2}</div>;
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
var spreads4 = <div {...p1} x={p3}>{p2}</div>;
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
@@ -0,0 +1,44 @@
=== tests/cases/conformance/jsx/tsxEmit2.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxEmit2.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxEmit2.tsx, 0, 20))
interface IntrinsicElements {
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
[s: string]: any;
>s : Symbol(s, Decl(tsxEmit2.tsx, 3, 3))
}
}
var p1, p2, p3;
>p1 : Symbol(p1, Decl(tsxEmit2.tsx, 7, 3))
>p2 : Symbol(p2, Decl(tsxEmit2.tsx, 7, 7))
>p3 : Symbol(p3, Decl(tsxEmit2.tsx, 7, 11))
var spreads1 = <div {...p1}>{p2}</div>;
>spreads1 : Symbol(spreads1, Decl(tsxEmit2.tsx, 8, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads2 = <div {...p1}>{p2}</div>;
>spreads2 : Symbol(spreads2, Decl(tsxEmit2.tsx, 9, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
>spreads3 : Symbol(spreads3, Decl(tsxEmit2.tsx, 10, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
var spreads4 = <div {...p1} x={p3} >{p2}</div>;
>spreads4 : Symbol(spreads4, Decl(tsxEmit2.tsx, 11, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
>spreads5 : Symbol(spreads5, Decl(tsxEmit2.tsx, 12, 3))
>div : Symbol(JSX.IntrinsicElements, Decl(tsxEmit2.tsx, 1, 22))
>x : Symbol(unknown)
>y : Symbol(unknown)
+68
View File
@@ -0,0 +1,68 @@
=== tests/cases/conformance/jsx/tsxEmit2.tsx ===
declare module JSX {
>JSX : any
interface Element { }
>Element : Element
interface IntrinsicElements {
>IntrinsicElements : IntrinsicElements
[s: string]: any;
>s : string
}
}
var p1, p2, p3;
>p1 : any
>p2 : any
>p3 : any
var spreads1 = <div {...p1}>{p2}</div>;
>spreads1 : JSX.Element
><div {...p1}>{p2}</div> : JSX.Element
>div : any
>p1 : any
>p2 : any
>div : any
var spreads2 = <div {...p1}>{p2}</div>;
>spreads2 : JSX.Element
><div {...p1}>{p2}</div> : JSX.Element
>div : any
>p1 : any
>p2 : any
>div : any
var spreads3 = <div x={p3} {...p1}>{p2}</div>;
>spreads3 : JSX.Element
><div x={p3} {...p1}>{p2}</div> : JSX.Element
>div : any
>x : any
>p3 : any
>p1 : any
>p2 : any
>div : any
var spreads4 = <div {...p1} x={p3} >{p2}</div>;
>spreads4 : JSX.Element
><div {...p1} x={p3} >{p2}</div> : JSX.Element
>div : any
>p1 : any
>x : any
>p3 : any
>p2 : any
>div : any
var spreads5 = <div x={p2} {...p1} y={p3}>{p2}</div>;
>spreads5 : JSX.Element
><div x={p2} {...p1} y={p3}>{p2}</div> : JSX.Element
>div : any
>x : any
>p2 : any
>p1 : any
>y : any
>p3 : any
>p2 : any
>div : any
+84
View File
@@ -0,0 +1,84 @@
//// [tsxEmit3.tsx]
declare module JSX {
interface Element { }
interface IntrinsicElements { }
}
module M {
export class Foo { constructor() { } }
export module S {
export class Bar { }
// Emit Foo
// Foo, <Foo />;
}
}
module M {
// Emit M.Foo
Foo, <Foo />;
export module S {
// Emit M.Foo
Foo, <Foo />;
// Emit S.Bar
Bar, <Bar />;
}
}
module M {
// Emit M.S.Bar
S.Bar, <S.Bar />;
}
module M {
var M = 100;
// Emit M_1.Foo
Foo, <Foo />;
}
//// [tsxEmit3.jsx]
var M;
(function (M) {
var Foo = (function () {
function Foo() {
}
return Foo;
})();
M.Foo = Foo;
var S;
(function (S) {
var Bar = (function () {
function Bar() {
}
return Bar;
})();
S.Bar = Bar;
})(S = M.S || (M.S = {}));
})(M || (M = {}));
var M;
(function (M) {
// Emit M.Foo
M.Foo, <M.Foo />;
var S;
(function (S) {
// Emit M.Foo
M.Foo, <M.Foo />;
// Emit S.Bar
S.Bar, <S.Bar />;
})(S = M.S || (M.S = {}));
})(M || (M = {}));
var M;
(function (M) {
// Emit M.S.Bar
M.S.Bar, <M.S.Bar />;
})(M || (M = {}));
var M;
(function (M_1) {
var M = 100;
// Emit M_1.Foo
M_1.Foo, <M_1.Foo />;
})(M || (M = {}));
@@ -0,0 +1,75 @@
=== tests/cases/conformance/jsx/tsxEmit3.tsx ===
declare module JSX {
>JSX : Symbol(JSX, Decl(tsxEmit3.tsx, 0, 0))
interface Element { }
>Element : Symbol(Element, Decl(tsxEmit3.tsx, 0, 20))
interface IntrinsicElements { }
>IntrinsicElements : Symbol(IntrinsicElements, Decl(tsxEmit3.tsx, 1, 22))
}
module M {
>M : Symbol(M, Decl(tsxEmit3.tsx, 3, 1), Decl(tsxEmit3.tsx, 13, 1), Decl(tsxEmit3.tsx, 27, 1), Decl(tsxEmit3.tsx, 32, 1))
export class Foo { constructor() { } }
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
export module S {
>S : Symbol(S, Decl(tsxEmit3.tsx, 6, 39), Decl(tsxEmit3.tsx, 17, 14))
export class Bar { }
>Bar : Symbol(Bar, Decl(tsxEmit3.tsx, 7, 18))
// Emit Foo
// Foo, <Foo />;
}
}
module M {
>M : Symbol(M, Decl(tsxEmit3.tsx, 3, 1), Decl(tsxEmit3.tsx, 13, 1), Decl(tsxEmit3.tsx, 27, 1), Decl(tsxEmit3.tsx, 32, 1))
// Emit M.Foo
Foo, <Foo />;
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
export module S {
>S : Symbol(S, Decl(tsxEmit3.tsx, 6, 39), Decl(tsxEmit3.tsx, 17, 14))
// Emit M.Foo
Foo, <Foo />;
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
// Emit S.Bar
Bar, <Bar />;
>Bar : Symbol(Bar, Decl(tsxEmit3.tsx, 7, 18))
>Bar : Symbol(Bar, Decl(tsxEmit3.tsx, 7, 18))
}
}
module M {
>M : Symbol(M, Decl(tsxEmit3.tsx, 3, 1), Decl(tsxEmit3.tsx, 13, 1), Decl(tsxEmit3.tsx, 27, 1), Decl(tsxEmit3.tsx, 32, 1))
// Emit M.S.Bar
S.Bar, <S.Bar />;
>S.Bar : Symbol(S.Bar, Decl(tsxEmit3.tsx, 7, 18))
>S : Symbol(S, Decl(tsxEmit3.tsx, 6, 39), Decl(tsxEmit3.tsx, 17, 14))
>Bar : Symbol(S.Bar, Decl(tsxEmit3.tsx, 7, 18))
>Bar : Symbol(S.Bar, Decl(tsxEmit3.tsx, 7, 18))
}
module M {
>M : Symbol(M, Decl(tsxEmit3.tsx, 3, 1), Decl(tsxEmit3.tsx, 13, 1), Decl(tsxEmit3.tsx, 27, 1), Decl(tsxEmit3.tsx, 32, 1))
var M = 100;
>M : Symbol(M, Decl(tsxEmit3.tsx, 35, 4))
// Emit M_1.Foo
Foo, <Foo />;
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
>Foo : Symbol(Foo, Decl(tsxEmit3.tsx, 5, 10))
}

Some files were not shown because too many files have changed in this diff Show More