Updating list-ops test generic types parameters

#1463
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 like Array.

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:

/*...*/
xit('list to empty list', () => {
  const list1 = List.create<number>()
  const list2 = List.create(1, 2, 3, 4)
  expect(list1.append(list2)).toEqual(list2)
})
/*...*/

In this first test I added the generic type parameter <number> to list1 so that, even though the constant list1 has no element, TypeScript understands that it stores the same type value as list2. I did not add <number> to list2 because the type of value it stores is automatically deduced by the parameters sent in the create function.


/*...*/
describe('filter list returning only values that satisfy the filter function', () => {
  xit('empty list', () => {
    const list1 = List.create<number>()
    expect(list1.filter((el) => el % 2 === 1)).toHaveValues()
  })
/*...*/

In this case I understand that <number> in filter refers to the type of value that the list returned by filter will store, however this is not necessary if List has a generic type, since the returned list will store the same type of value as the original list.

I think these changes make sense.

If you recreate your PR and tag me, I can get it reopened and merged.

I did a PR here it is: #1463, tell me if you need me to create a new PR.

The problem is that that PR no longer works because the origin branch is gone, which is why you need to recreate it.

1 Like

Sorry, I forgot I had deleted it. :sweat_smile:

1 Like