命名空间和引入
//文件Shape.ts
namespace Drawing{
    //export表示能让别的文件访问到
    export interface IShape
    {
        draw()
    }
}

//文件Other  引入的文件只在一个命名空间下
/// <reference path = "Shape.ts" />
class Circle implements Drawing.IShape{
    public draw()
    {
        console.log("画画")
    }
}

let cir = new Circle()
cir.draw()

首页 我的博客
粤ICP备17103704号