'TypeScript create type from generic argument

Say I create an instance of my class like:

var x = new SomeClass<SomeModel>()

Where the definitions are:

interface SomeModel{
   someString: string
   someArray: []
}

class SomeClass<T>{
   doSomething(){
      ...
   }
}

My question is - in doSomething I need to be able to look at the type T and itterate over it's properties and see what the type of each property is - how can I do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source