Skip to content

Undefined JSX.Element crashes typechecker with function in element #7286

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Bobris opened this issue Feb 28, 2016 · 1 comment
Closed

Undefined JSX.Element crashes typechecker with function in element #7286

Bobris opened this issue Feb 28, 2016 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue

Comments

@Bobris
Copy link

Bobris commented Feb 28, 2016

TypeScript Version:

1.8.2

Code

tsconfig.json:

{
    "compilerOptions": {
        "jsx": "react"
    },
    "files": [
        "app.tsx"
    ]
}

app.tsx:

function Test() { }
<Test></Test>

Expected behavior:

Successful compilation, because undefined JSX.Element should be treated as any type.

Actual behavior:

Throws exception:
typescript/lib/tsc.js:32989
throw e;
^

TypeError: Cannot read property 'flags' of undefined
at isRelatedTo (typescript\lib\tsc.js:15954:32)
at checkTypeRelatedTo (typescript\lib\tsc.js:15882:26)
at checkTypeAssignableTo (typescript\lib\tsc.js:15760:20)
at isTypeAssignableTo (typescript\lib\tsc.js:15754:20)
at getJsxElementAttributesType (typescript\lib\tsc.js:18394:47)
at checkJsxOpeningLikeElement (typescript\lib\tsc.js:18495:40)
at checkJsxElement (typescript\lib\tsc.js:18200:13)
at checkExpressionWorker (typescript\lib\tsc.js:20367:28)
at checkExpression (typescript\lib\tsc.js:20279:42)
at checkExpressionStatement (typescript\lib\tsc.js:21539:13)

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter labels Feb 29, 2016
@mhegazy mhegazy added this to the TypeScript 2.0 milestone Feb 29, 2016
RyanCavanaugh added a commit to RyanCavanaugh/TypeScript that referenced this issue Mar 1, 2016
@RyanCavanaugh RyanCavanaugh added the Fixed A PR has been merged for this issue label Mar 1, 2016
@RyanCavanaugh
Copy link
Member

PR @ #7308

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Domain: JSX/TSX Relates to the JSX parser and emitter Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants