Please edit your post and put your code inside code tags, you can find out how here: Using code tags properly
And then please show us the whole error message, which line it is pointing to?
I’m guessing without reading your text-salad that you’re trying to return a string instead of T, but I’m not sure, when you have done both things we will see what’s the problem.