Skip to content

TSX: Cannot read property 'flags' of undefined #3959

@s-panferov

Description

@s-panferov

Minimal example to reproduce:

/// <reference path="./react.d.ts" />

import * as React from 'react';

class C extends React.Component<any, any> {
    render() {
        return null
    }
}

let C1: React.Component<any, any> = C;
let a = <C1 />;

Trace:

/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:28987
                throw e;
                      ^
TypeError: Cannot read property 'flags' of undefined
    at getApparentType (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:12754:21)
    at getPropertyOfType (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:12830:20)
    at getTypeOfPropertyOfType (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:11889:24)
    at getJsxElementAttributesType (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:16075:46)
    at checkJsxOpeningLikeElement (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:16138:40)
    at checkJsxSelfClosingElement (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:15860:13)
    at checkExpressionWorker (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:17893:28)
    at checkExpression (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:17804:42)
    at checkExpressionCached (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:17765:38)
    at getTypeForVariableLikeDeclaration (/Users/panferov/Workspace/out/TypeScript/bin/tsc.js:11968:24)

Command to run:

tsc --jsx react --target es6 issue.tsx

Compiler is the latest:

commit 4e85864b2dca574152134d532851708cecec1c3c

Here is the repo https://github.com/s-panferov/ts-jsx-issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions