I'm trying to create an object in typescript. I want to do this generically so that it automatically gets it's default based off of its type
interface IModal {
content: string;
count: number
}
Normally I would declare an Instance of it like so:
var modal: IModal = {
content: '',
count: 0
};
I don't want to have to do this everytime. I want to do this so that the it automatically create an instance of the interface with Typed default i.e
number = 0,
string = '',
boolean = false,
MyCustom = new MyCustom
I want to do something like this:
export class MakeObject {
Make<T> : T = function(iInterface) => {
return default(T);
}
}
But I don't think that will work