Skip to content

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

Closed
@Bobris

Description

@Bobris

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)

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSX/TSXRelates to the JSX parser and emitterFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions