打字稿使用外部模块:导出和导入

时间:2016-11-21 11:14:54

标签: typescript

当我阅读here时,在Typescript中使用命名空间不是最佳选择。相反,我尝试使用外部模块,但我遇到了一些问题。

File1.ts

export class MySrv {
    // ...     
}
export let Services = angular.module("myApp.core").service("mySrv", MySrv);

File2.ts

"use strict";
import * as Services from "../core/mySrv";

class MainAreaCtrl {
    // ...   
}

export default angular.module("myApp.main-area").controller("MainAreaCtrl", MainAreaCtrl);

我遇到的问题是:未捕获:ReferenceError:未定义导出

问题是:使用ES2015语法在TypeScript中导入和导出模块的正确方法是什么?

问候!

0 个答案:

没有答案
相关问题