-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Elaborate array and tuple relation errors #30916
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
Elaborate array and tuple relation errors #30916
Conversation
7fa7c12
to
214c023
Compare
@@ -52,7 +52,7 @@ tests/cases/conformance/types/tuple/readonlyArraysAndTuples.ts(25,5): error TS27 | |||
!!! error TS2740: Type 'readonly string[]' is missing the following properties from type '[string, string]': 0, 1, pop, push, and 5 more. | |||
mt = rt; // Error | |||
~~ | |||
!!! error TS2740: Type 'readonly [string, string]' is missing the following properties from type '[string, string]': pop, push, reverse, shift, and 3 more. | |||
!!! error TS4105: A 'readonly' tuple cannot be assigned to a mutable array-like type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think the fact that these lack context is a bit of a problem. If these aren't acting as elaborations, then maybe both messages could be replaced with
The type '{0}' is considered 'readonly' and cannot be assigned to the mutable type '{1}'.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, it slipped past me that these errors don't include Foo is not assignable to Bar
. So:
The type '{0}' is considered 'readonly' and cannot be assigned to the mutable type '{1}'.
which can probably subsume both new error messages?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we remove the word "considered" here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me!
214c023
to
2ea91a0
Compare
Beautiful, thanks Jack! |
Anytime! |
Fixes #30839