-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Closed
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed
Description
TypeScript Version: 2.0.3
This code compiles in TS 1.8 but not in 2.0.3
Code
class A { }
class B { constructor(public b: number) {} }
function foo(x: A | B): number | boolean {
if (x instanceof A) { return true; }
else if (x instanceof B) { return x.b; }
// ^ Property 'b' does not exist on type 'never'.
};
This error only appears if class A
has no fields or methods,
if I add a field or a method the error disappears (but not constructor).
Metadata
Metadata
Assignees
Labels
Design LimitationConstraints of the existing architecture prevent this from being fixedConstraints of the existing architecture prevent this from being fixed