-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Instantiation expressions don't filter signatures with non-matching constraints #51694
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Is it that, or is it just picking the last overload, similar to what happens with |
IIRC what Iβve seen when debugging this - itβs an intersection, itβs not picking a single matching signature. I think that it makes sense per the second part of this comment: #51695 (comment) . Itβs just that when mapping those signatures |
I went back to recheck the implementation, "intersection" definitely caught my eye somewhere around this code but it seems that it was in some different parts. So this isn't actually becoming an intersection, but the effect is kinda similar - it's an object type with multiple signatures (and more): |
@ahejlsberg any thoughts? |
What would need to happen from the TypeScript team perspective for this change to be accepted? It seems to be a very reasonable improvement and it also addresses a couple other problems (linked above). |
Any progress on this? Just encountered it and it'd be nice to have |
Bug Report
π Search Terms
instantiation expression, overload
π Version & Regression Information
β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
This instantiation expression errors despite the fact that a matching signature exists.
π Expected behavior
It sounds likely that most people would assume that this should work similarly to how overloads are chosen - but instead an intersection is being created based on all signatures with the same type arguments arity.
originally reported by @herjiict here
The text was updated successfully, but these errors were encountered: