如何从typescript中导入模块调用方法?

时间:2018-04-05 17:17:59

标签: javascript typescript

只是试图理解打字稿类实例的基本概念我已导入测试模块现在我试图在类上调用该方法,但它不打印任何东西。任何帮助将不胜感激?

main.ts

 export class Testbase {
      public test(arg: string) {
        return arg;
      }

    }

instance.ts

        import {Testbase} from "./main";

        export class CallBack {
          private testClass: Testbase;
          private desc: string = "testing typesceript";
          constructor() {
            this.testClass = new Testbase();
            this.testClass.test(this.desc);
            console.log('test');
          }
           public printStr(str:string) {
             this.testClass.test(this.desc);
           }

        }

0 个答案:

没有答案