-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Design Meeting Notes, 4/26/2023 #54038
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
Yes, that's true - I forgot to mention that in the feature request but this limitation was knowingly there. I consider that to be a fair tradeoff because the goal of the proposal was that the consumer/user of the function signature wouldn't have to do anything to utilize this feature. I also worked under the assumption that the default behavior of choosing defaults over potential inferences just can't be changed.
I can sympathize with this as a basic rule of thumb but I have situations in which this makes a lot of sense. Argument types are meant to be derived from the type arguments but at times there might not even be good inference candidate spots for certain type parameters. In a similar way, I've seen Ryan mentioning that a contravariant-only inference is fishy - and I agree, usually it is. But with certain APIs we need that - so we either allow for partial type arguments application and avoid contravariant-only inferences or we have to rely on them because partial type arguments are not a thing. Both solutions are fishy - to some extent 😉 Anyway, I feel like those situations arise often in schema-based APIs and in case of aggregates/bulk/factory APIs when people want to "bind" things to certain argument types while inferring the rest. I've seen that quite a bit in the wild (and in some of my APIs as well). This also gives a better manual control over subtype/supertype selection and accidental widening etc.
Is there anything I could help out with on that front? I care about this feature a lot and I'd love to keep the ball rolling :) |
If I understand this correctly it would work for inference but signatures would still become horrendous to read
I wouldn't call something that has semantic meaning an implementation detail, the deferred resolution of indexed access was confirmed as expected / intentional in prior issues such as #40928 |
#54000
never
in empty array andT
#53995
never
, used to be an error#53999
preferinfer
. Can we just do something like that behavior by default?_
placeholder PR lets any parameter be omittednew Set<string>()
comes to mind)_
proposal again, or even just always allowing partial tye argument specification (in expression positions)_
PR, run RWC, see what happens#54005
#53970
(F & { readonly A: A })['type']
used to reduce toF['type']
without acknowledging that the intersection could producenever
(A & B)[C]
toA[C] & B[C]
during inference and inferring from both#54011
typescript/lib
?The text was updated successfully, but these errors were encountered: