-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.2.0+
Code
class AInfo {
a_count:number = 1;
}
class BInfo {
b_count:number = 1;
}
class Base {
next:Base;
id:number = 0;
}
class A extends Base {
constructor(readonly info:AInfo) {
super();
}
}
class B extends Base {
constructor(readonly info:BInfo) {
super();
}
}
let target:Base = ...;
while (target) {
if (target instanceof A) {
target.info.a_count = 3;
} else if (target instanceof B) {
target.info.b_count = 3;
}
target = target.next;
}Expected behavior:
TS2551: Property 'b_count' does not exist on type 'AInfo'. Did you mean 'a_count'?
When code place in WHILE
Actual behavior:
no error
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFixedA PR has been merged for this issueA PR has been merged for this issue