//命名空间也需要export,外部才能够使用exportnamespace com.hongying{//外部使用类就需要exportexportclassDog{
name:string;constructor(name:string){this.name=name;}run():void{console.log(`${this.name} is running--com.hongying`)}}//可以暴露多个对象exportfunctionHello(){console.log(`Hello ------`);}}
SmallDog.tx 项目代码
exportnamespace com.rhino{exportclassDog{
name:string;constructor(name:string){this.name=name;}run():void{console.log(`${this.name} is running--com.rhino`)}}}