Creating model classes in TypeScript

后端 未结 3 1372
别跟我提以往
别跟我提以往 2021-02-01 12:48

Hi I am new to TypeScript and I come from both a C# and JavaScript background. I am trying to create a way that allows me to create class models similar to what we can do in C#.

3条回答
  •  清歌不尽
    2021-02-01 13:15

    Giving the fields default values should do what you're looking for.

    export class DonutChartModel {
        dimension: number = 0;
        innerRadius: number = 0;
        backgroundClass: string = "";
        backgroundOpacity: number = 0;
    }
    

提交回复
热议问题