Skip to content

Bug: Cannot read property 'flags' of undefined #2127

Closed
@osi-oswald

Description

@osi-oswald

Trying to compile

interface IBar {
    [barId: string]: any;
}

interface IFoo {
    foo<TBar extends IBar>(bar: TBar, bar1: (bar: TBar)=>any, bar2: (bar: TBar)=>any);
}

var foo: IFoo;
foo.foo({bar: null}, bar => null, bar => null);

leads to the following error

if (source.flags & 128 /* Enum */ && target === numberType
          ^
TypeError: Cannot read property 'flags' of undefined
    at isRelatedTo (tsc.js:13077:31)
    at checkTypeRelatedTo (tsc.js:13048:26)
    at checkTypeSubtypeOf (tsc.js:13029:20)
    at reportNoCommonSupertypeError (tsc.js:13618:13)
    at resolveCall (tsc.js:14945:21)
    at resolveCallExpression (tsc.js:15075:20)
    at getResolvedSignature (tsc.js:15125:47)
    at checkCallExpression (tsc.js:15140:29)
    at checkExpressionWorker (tsc.js:15648:28)
    at checkExpressionOrQualifiedName (tsc.js:15605:42)

tsc version 1.4.1.0

You can also put this code into the typescript Playground, which does not complie it as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions