TypeScript/tests/baselines/reference/jsxAndTypeAssertion.js
Nathan Shively-Sanders 89a737c871
Improve parser recovery for unclosed/mismatched JSX elements (#43780)
* First draft

Everything works, the error messages for unmatched opening elements
could still use improvement, plus there is tonnes of unused and ugly
code.

1. Make sure the parser can recover from all kinds of unclosed tags.
2. Improve the parse tree for unmatched opening tags.
3. Better errors at some point.

* Lots of cleanup

* Improve readability of construction/fix lint

* improve line-length formatting
2021-05-20 07:20:57 -07:00

49 lines
886 B
TypeScript

//// [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 = /** @class */ (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>
:
}
</></>}</></>}/></></></>;