Updating list-ops test generic types parameters #1463
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I added and deleted generic type parameters from the list-ops exercise tests.
I did this because I was having problems compiling the code and I also noticed that several generic types were redudant, considering that the
List
class has a generic type likeArray
.I will list 2 of the changed tests and the reasons why I added or removed the generic type parameter, the other tests were changed for the same reasons:
In this first test I added the generic type parameter
<number>
tolist1
so that, even though the constantlist1
has no elements, TypeScript understands that it stores the same type value aslist2
. I did not add<number>
tolist2
because the type of value it stores is automatically deduced by the parameters sent in thecreate
function.In this case I understand that
<number>
infilter
refers to the type of value that the list returned byfilter
will store, however this is not necessary ifList
has a generic type, since the returned list will store the same type of value as the original list.