【发布时间】:2017-06-20 09:10:07
【问题描述】:
我写了以下文件:
main.ts:
///<reference path="./external.ts"/>
hello();
external.ts
var hello = function() {
console.log("hello");
}
在 html 文件中我放置了语句:
<script src="external.js" type="text/javascript"></script>
<script src="main.js" type="text/javascript"></script>
当我用 html 文件打开浏览器时,我预计会调用函数“hello”,但没有。我得到了错误:
未捕获的引用错误:未定义导出
这个问题和我之前发的问题差不多:Typescript ///<reference path="...">: why doesn't it work for me?
但这一次它处理的是浏览器中的代码,而不是服务器端的代码(如上一个问题)。
【问题讨论】:
-
exports is not defined听起来像是语法错误,我会仔细检查并确保无论您在哪里导出它都显示export而不是exports
标签: typescript