Soundness: this
type is computed with respect to the object it is declared on, rather than the object it is called on
#49991
Labels
Design Limitation
Constraints of the existing architecture prevent this from being fixed
Bug Report
This prevents the type-safe construction of path-dependent builders (e.g. a builder where a certain method can only be called once, or where calling a certain method prevents calling other methods)
🔎 Search Terms
this type chained fluent builder generic
🕗 Version & Regression Information
this
type⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
console.log(burgerBuilder.withMayo().withKetchup().withMayo().order())
correctly fails at runtime, but passes type-checking🙂 Expected behavior
console.log(burgerBuilder.withMayo().withKetchup().withMayo().order())
should fail type-checking.The text was updated successfully, but these errors were encountered: