TS类的使用

自定义类:

export default class A{
    public name:string;
    public getString(){
         return this.name;
    }
    constructor(name:string){
        this.name=name;
    }
}

import A from "./~" //路径
class B{
     let a:A=new ();
     a.getString();
}


原文地址:https://www.cnblogs.com/lichuangblog/p/9707785.html