typescript specify interface with generic but must be string or number code example
Example 1: typescript class type t
class GenericNumber {
zeroValue: T;
add: (x: T, y: T) => T;
}
let myGenericNumber = new GenericNumber();
myGenericNumber.zeroValue = 0;
myGenericNumber.add = function(x, y) { return x + y; };
Example 2: how to make a generic variable in javascript
var x = 1;
var y = 1;
if (x == y) {
x = x + 1
}