0
我有聲明文件module.d.ts打字稿模塊加載錯誤
declare module "ArrayItem" {import out = require("models/ArrayItem"); export = out;}
現在我有一個文件Array.ts和第一行是
/// <reference path="../module.d.ts" />
import array = require("ArrayItem").
但是,這是行不通的。我得到腳本錯誤。
如果我使用,
/// <reference path="../module.d.ts" />
import array = require("models/ArrayItem")
然後,我沒有得到任何錯誤。
模塊加載在這裏有什麼問題?
如果我有一個module.d.ts,那麼應該從require(「arrayitem」)加載arrayitem模塊。
對不起?或者我應該總是ArrayItem的正確路徑?
我很困惑。有人可以在這裏幫忙嗎?
ok..so我應該總是說import array = require(「models/ArrayItem」),即使我有module.d.ts文件?你能否詳細說明我應該在這裏做什麼? – user2325247
您有一個參考其他打字稿模塊的打字稿模塊,因此不需要使用module.d.ts。如果你在打字稿中使用JavaScript庫,你只會這樣做。 –
明白了......我必須做出一些改變。謝謝, – user2325247