[英]How to use module loading in TypeScript
在TypeScript中,我有這樣的代碼:
萊文施泰因/ LevensteinAlgorithm.ts
export module levenstein {
export class LevensteinAlgorithm
{
getDistance(left: string, right: string): number {
// Some code for the alogorithm...
}
}
}
為了對此進行單元測試,我在另一條路徑中編寫了一個測試:
測試/ levensteinAlgorithmTests.ts
/// <reference path="../scripts/typings/qunit/qunit.d.ts" />
/// <reference path="../levenstein/levensteinalgorithm.ts" />
QUnit.module("levensteinalgorithm.ts tests");
import levenstein = require("levenstein/LevensteinAlgorithm");
test("Simple update cost is equal to 1", ()=> {
// Arrange
var leven = new levenstein.LevensteinAlgorithm();
//...
不幸的是,它有一個構建錯誤,說:
Property LevensteinAlgorithm doesn't exist on type: ....
我正在使用QUnit和Chutzpah來運行測試。
我的模塊加載有什么問題?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.