allows for creation of functions that can create new instances of generic types. Ex:
function get<T>(cType: Class<T>, ...args: any[]): T { return new cType(...args);} Copy
function get<T>(cType: Class<T>, ...args: any[]): T { return new cType(...args);}
which can then be used like:
let obj: CustomObj = get(CustomObj, 'foo', 123); Copy
let obj: CustomObj = get(CustomObj, 'foo', 123);
assuming that CustomObj looks like:
CustomObj
class CustomObj { someStr: string; someNum: number; constructor(inputStr: string, inputNum: number) { this.someStr = inputStr; this.someNum = inputNum; }} Copy
class CustomObj { someStr: string; someNum: number; constructor(inputStr: string, inputNum: number) { this.someStr = inputStr; this.someNum = inputNum; }}
Rest
Readonly
Generated using TypeDoc
allows for creation of functions that can create new instances of generic types. Ex:
which can then be used like:
assuming that
CustomObj
looks like: