1. // ↓ 接口 interface
    2. interface Interface1 {
    3. name:string; // ← 分号
    4. age:number, // ← 逗号
    5. sex?:string // ← 不写分号,也不写逗号
    6. interests?:string[];
    7. }
    8. // ↓ 类型 type
    9. type Type1 = {
    10. name:string;
    11. age:number,
    12. sex?:string
    13. interests?:string[];
    14. }
    15. const in1:Interface1 = {name:'张三', age:18}
    16. console.log(in1.name);
    17. const t1:Type1 = {name:'李四', age:13}
    18. console.log(t1.age);

    上面关于 interface, type的写法都没有语法错误(不会报错)

    结论:
    interface 和 type 中可以用分号或逗号,
    注意:class 中只能用分号。