Inference isn't working with constructor that contextually types 'this' with intersections of itself #12846
Labels
Awaiting More Feedback
This means we'd like to hear from more people who would be helped by this feature
Suggestion
An idea for TypeScript
TL;DR: There should be no errors in the below example.
I am trying to model a library that takes an options bag for its constructor, and exposes those properties onto the instance that is eventually produced.
For example, if I wrote
I should be able to write
instance.hello()
orinstance.world()
.Additionally, since
this
inworld
will be bound to the instance,this.hello
should be legal and well-typed in the above example.However, I'm not able to come up with a version of this that works.
In the above example, there should be no errors - however, it appears that no inferences are being drawn as a type argument for
Methods
, and boththis.hello
andinst.hello
are causing errors.The text was updated successfully, but these errors were encountered: