{ + constructor(props?: P, context?: any); + props: P; + } +} + +export class ShortDetails extends React.Component<{ id: number }, {}> { + public render(): JSX.Element { + if (this.props.id < 1) { + return (
); + } + } +} + +//// [tsxCorrectlyParseLessThanComparison1.js] +"use strict"; +var __extends = (this && this.__extends) || function (d, b) { + for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; + function __() { this.constructor = d; } + d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); +}; +var ShortDetails = (function (_super) { + __extends(ShortDetails, _super); + function ShortDetails() { + _super.apply(this, arguments); + } + ShortDetails.prototype.render = function () { + if (this.props.id < 1) { + return (React.createElement("div", null)); + } + }; + return ShortDetails; +}(React.Component)); +exports.ShortDetails = ShortDetails; diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.symbols b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.symbols new file mode 100644 index 0000000000000..d00b4ca115ff2 --- /dev/null +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.symbols @@ -0,0 +1,55 @@ +=== tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx === +declare module JSX { +>JSX : Symbol(JSX, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 0)) + + interface Element { +>Element : Symbol(Element, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 20)) + + div: string; +>div : Symbol(Element.div, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 1, 23)) + } +} +declare namespace React { +>React : Symbol(React, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 4, 1)) + + class Component{ +>Component : Symbol(Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25)) +>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20)) +>S : Symbol(S, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 22)) + + constructor(props?: P, context?: any); +>props : Symbol(props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 20)) +>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20)) +>context : Symbol(context, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 30)) + + props: P; +>props : Symbol(Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46)) +>P : Symbol(P, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 6, 20)) + } +} + +export class ShortDetails extends React.Component<{ id: number }, {}> { +>ShortDetails : Symbol(ShortDetails, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 10, 1)) +>React.Component : Symbol(React.Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25)) +>React : Symbol(React, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 4, 1)) +>Component : Symbol(React.Component, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 5, 25)) +>id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51)) + + public render(): JSX.Element { +>render : Symbol(ShortDetails.render, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 71)) +>JSX : Symbol(JSX, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 0)) +>Element : Symbol(JSX.Element, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 0, 20)) + + if (this.props.id < 1) { +>this.props.id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51)) +>this.props : Symbol(React.Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46)) +>this : Symbol(ShortDetails, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 10, 1)) +>props : Symbol(React.Component.props, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 7, 46)) +>id : Symbol(id, Decl(tsxCorrectlyParseLessThanComparison1.tsx, 12, 51)) + + return (
); +>div : Symbol(unknown) +>div : Symbol(unknown) + } + } +} diff --git a/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.types b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.types new file mode 100644 index 0000000000000..ca1bc492909a6 --- /dev/null +++ b/tests/baselines/reference/tsxCorrectlyParseLessThanComparison1.types @@ -0,0 +1,59 @@ +=== tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx === +declare module JSX { +>JSX : any + + interface Element { +>Element : Element + + div: string; +>div : string + } +} +declare namespace React { +>React : typeof React + + class Component{ +>Component : Component
+>P : P +>S : S + + constructor(props?: P, context?: any); +>props : P +>P : P +>context : any + + props: P; +>props : P +>P : P + } +} + +export class ShortDetails extends React.Component<{ id: number }, {}> { +>ShortDetails : ShortDetails +>React.Component : React.Component<{ id: number; }, {}> +>React : typeof React +>Component : typeof React.Component +>id : number + + public render(): JSX.Element { +>render : () => JSX.Element +>JSX : any +>Element : JSX.Element + + if (this.props.id < 1) { +>this.props.id < 1 : boolean +>this.props.id : number +>this.props : { id: number; } +>this : this +>props : { id: number; } +>id : number +>1 : number + + return (
); +>() : any +> : any +>div : any +>div : any + } + } +} diff --git a/tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx b/tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx new file mode 100644 index 0000000000000..87a3d2d12aa37 --- /dev/null +++ b/tests/cases/conformance/jsx/tsxCorrectlyParseLessThanComparison1.tsx @@ -0,0 +1,20 @@ +// @jsx: react +declare module JSX { + interface Element { + div: string; + } +} +declare namespace React { + class Component{ + constructor(props?: P, context?: any); + props: P; + } +} + +export class ShortDetails extends React.Component<{ id: number }, {}> { + public render(): JSX.Element { + if (this.props.id < 1) { + return (
); + } + } +} \ No newline at end of file