【问题标题】:TypeScript Reference Class File Not WorkingTypeScript 参考类文件不工作
【发布时间】:2015-04-19 06:13:45
【问题描述】:

我正在尝试将一个 TypeScript 类文件 Mandelbrot.ts 包含在另一个文件 app.ts 中。在尝试了the solution in this question 之后,我无法让它工作。

app.ts

/// <reference path="Mandelbrot.ts" />

window.onload = function() {
    var mandelbrot = new Mandelbrot("canvas");
};

Mandelbrot.ts(与 app.ts 相同的文件夹)

class Mandelbrot {
    ...
}

app.js(编译输出)

/// <reference path="Mandelbrot.ts" />
window.onload = function () {
    var mandelbrot = new Mandelbrot("canvas");
};
//# sourceMappingURL=app.js.map

编译器似乎忽略了我的引用请求,因为在浏览器中没有任何作用。没有任何编译器错误或警告。我正在使用作为 Visual Studio 2013 Ultimate 一部分的编译器。

【问题讨论】:

    标签: visual-studio-2013 typescript


    【解决方案1】:

    如果您希望根据参考 cmets 导入文件,则需要使用“--out”进行编译

    说我觉得是个坏主意:https://github.com/TypeStrong/atom-typescript/blob/master/docs/out.md 你应该看看 requirejs 或 systemjs

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-02-22
      • 2013-09-10
      • 2022-01-23
      • 1970-01-01
      • 1970-01-01
      • 2023-01-09
      • 2012-10-16
      相关资源
      最近更新 更多