-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: This-TypingThe issue relates to providing types to thisThe issue relates to providing types to this
Milestone
Description
TypeScript Version: 3.1.1-insiders.20180926
Search Terms: this chain
Code
class Builder {
private _class: undefined;
withFoo<T>() {
return this as this & { foo: T }
}
withBar<T>() {
return this as this & { bar: T }
}
withFooBar<T>() {
return this.withFoo<T>().withBar<T>();
}
}
let good = new Builder().withFoo<number>().withBar<number>();
let bad = new Builder().withFooBar<number>();
good = bad;
Expected behavior:
good
& bad
should be identical
Actual behavior:
bad
is missing foo
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: This-TypingThe issue relates to providing types to thisThe issue relates to providing types to this