Inconsistent error between different versions of the same function with required parameter following an optional one #57565
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
π Search Terms
error function optional required rest
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?ts=5.5.0-dev.20240227#code/GYVwdgxgLglg9mABAIwIYCcAUqBciwgC2yApugDQoD8eBxZlEtRpFiAdJxgOYDOevKOhhhuAbQC6ASkQBvAL4AoRWnSKA9OsQA9KolCRYCFBmzN6bZDXwsGiJjYuVO7Hv0SDhoyVLwA3OBgAE2VVTABGKQBuRE1EAFEADwAHEmgSIMRUKEQAGxJUQUQAZiz0biISMCheSmQQHO44HPD2TAAmAFZuqWUDaHgkNAAvM0dWOus6CY4ucvcxB2m7FzcBIRFxCWk5JRVUYY0tXX1wAeMRseXLKds2JbvnOb51ry3fRADg0IOI6NitElUulMtk8gUiqUeJVqrUUA1EE0Wm0uj1FEA
π» Code
π Actual behavior
We get an error within the
bar
declaration ("'c' is declared but its value is never read.(6133)") but we get none inbaz
. They are pretty much equivalent.π Expected behavior
I'd expect this error to be raised consistently here (or not raised consistently).
In addition to that,
b
comes with the question mark in both quick infos here. TypeScript understands that at least 3 arguments are required here. It means that effectivelyb
is required in both cases and?
is somewhat misleading here. I think it would be good to normalize this. It already is normalized with tuples:Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: