I started learning TS, and I can't understand what is wrong with this class method:
class HoldAnything<T> {
data: T
add(a: T): T {
return this.data + a
}
}
VS code underlines return this.data + a, and it says:
Operator + cannot be applied to types T and T
I can't understand why it's showing me this error. Probably, it was answered somewhere already, however, I can't find it. I'd appreciate if someone could explain what is wrong with the method or point me to the answer.