Skip to content

InstanceOf incorrectly narrow when two type extends same base class #10422

Closed
@yuit

Description

@yuit

Version: master

class B { name: string }
class A { }
class C { name: string; }
var a: A | C;
if (!(a instanceof A)) {
    a;  // a has "never" type 
}

The change is a result of the PR #10216. It is followed the specification in that PR. Though I wonder whether this should get treated differently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Design LimitationConstraints of the existing architecture prevent this from being fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions