-
Notifications
You must be signed in to change notification settings - Fork 27k
refactor(animations): change errors type from any to string #44726
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
refactor(animations): change errors type from any to string #44726
Conversation
errors in the animations code are of type `any` but are consistently used as if there were `string`s, change `any` to `string` to make typing more accurate
f90646a to
9ce81b9
Compare
|
Weird that the errors being thrown are strings. That's a really bad practise. By the way, your description is wrong. This is perfectly valid: |
They are not being thrown as strings, the
Yeah that's a good point, but yeah they are implementing their own By the way, even if the errors as you mentioned would be shown in a readable way, I believe that it would still look pretty awkward since it would be like: |
AndrewKushnir
left a comment
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.
@dario-piotrowicz thanks for the cleanup 👍
jessicajaniuk
left a comment
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.
LGTM 🍪
Thanks for cleaning this up!
|
This PR was merged into the repository by commit ece530f. |
errors in the animations code are of type `any` but are consistently used as if there were `string`s, change `any` to `string` to make typing more accurate PR Close #44726
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
errors in the animations code are of type
anybut are consistentlyused as if there were
strings, changeanytostringto maketyping more accurate
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
Issue
Issue Number: N/A
Does this PR introduce a breaking change?
Other information
I am not completely sure why they were
anys in the first place, I'd imagine it was done in order to make the code more flexible 🤔Anyways as far I can tell all errors are just strings in the animations code and there are also parts in which getting something different from a string would likely create undesirable results, mainly when combining them together for the generation of an error message, for example like so:
angular/packages/animations/browser/src/render/timeline_animation_engine.ts
Line 37 in a92a89b
here if errors could be more complex data structures such as objects, when converted to strings by
join(unless they implement their owntoString) would just produce"[object Object]"which of course would produce a pretty bad error messageAlso I don't think this is part of any public api so it should be a safe change to make 🙂