interface ClockInterface { new (hour: number, minute: number): ClockInterface; } class MyArray1 <M>{ val: M; set(num: M){ this.val = num; } get(){ return this.val; } } var num = 1234; var arr = '2222'; let a1 = new MyArray1<number>(); a1.set(num); let a2 = new MyArray1<string>(); a2.set(arr); let aa = a1.get(); aa.toFixed(2) a2.get().toLocaleUpperCase();