Revert "Apparently I don't know how to use type variables for generics in TS."
This reverts commit 8bf1a8b1.