Ich versuche, ein Objekt in Typoskript zu erstellen. Ich will das so allgemein tun, dass sie es StandardTypescript Create Generisches Objekt
interface IModal {
content: string;
count: number
}
Normalerweise basieren weg von seiner Art automatisch bekommen würde ich eine Instanz davon wie so erklärt:
var modal: IModal = {
content: '',
count: 0
};
Ich will nicht muss das immer tun. Ich möchte, dies zu tun, so dass die automatisch eine Instanz der Schnittstelle mit typisierten Standard dh
erstellennumber = 0,
string = '',
boolean = false,
MyCustom = new MyCustom
ich so etwas wie dies tun will:
export class MakeObject {
Make<T> : T = function(iInterface) => {
return default(T);
}
}
Aber ich glaube nicht, dass Wille arbeiten
Warum die down vote? –